diff options
Diffstat (limited to '')
88 files changed, 4962 insertions, 0 deletions
diff --git a/OS/Makefile-Base b/OS/Makefile-Base new file mode 100644 index 0000000..78f5516 --- /dev/null +++ b/OS/Makefile-Base @@ -0,0 +1,995 @@ +# 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 +# concatenates the configuration settings from Local/Makefile and other, +# optional, Local/* files at the front of this file, to create Makefile in the +# build directory. +# +# Copyright (c) The Exim Maintainers 1995 - 2022 + +SHELL = $(MAKE_SHELL) +SCRIPTS = ../scripts +O = ../OS +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 compile commands can be very long. To make the output look better, +# they are not normally echoed in full. To get full echoing, the caller +# must set FULLECHO='' on the command line and call make with -e. We default +# FULLECHO to '@' to suppress the full echo. Then define an abbreviation. + +FULLECHO = @ +FE = $(FULLECHO) + +# 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: utils exim +config: $(EDITME) checklocalmake Makefile os.c config.h version.h version.sh macro.c + +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: $(SCRIPTS)/Configure-os.h \ + $(O)/os.h-FreeBSD \ + $(O)/os.h-GNU \ + $(O)/os.h-Linux \ + $(O)/os.h-OpenBSD \ + $(O)/os.h-SunOS5 + $(SHELL) $(SCRIPTS)/Configure-os.h + +# Build the os.c file + +os.c: ../src/os.c \ + $(SCRIPTS)/Configure-os.c \ + $(O)/os.c-FreeBSD \ + $(O)/os.c-GNU \ + $(O)/os.c-Linux \ + $(O)/os.c-SunOS5 + $(SHELL) $(SCRIPTS)/Configure-os.c + +# Build the config.h file. + +config.h: Makefile buildconfig ../src/config.h.defaults $(EDITME) + $(SHELL) $(SCRIPTS)/Configure-config.h "$(MAKE)" + +# Build the builtin-macros data struct + +MACRO_HSRC = macro_predef.h os.h globals.h config.h macros.h \ + routers/accept.h routers/dnslookup.h routers/ipliteral.h \ + routers/iplookup.h routers/manualroute.h routers/queryprogram.h \ + routers/redirect.h + +OBJ_MACRO = macro_predef.o \ + macro-globals.o macro-readconf.o macro-route.o macro-transport.o macro-drtables.o \ + macro-acl.o macro-tls.o \ + macro-appendfile.o macro-autoreply.o macro-lmtp.o macro-pipe.o macro-queuefile.o \ + macro-smtp.o macro-accept.o macro-dnslookup.o macro-ipliteral.o macro-iplookup.o \ + macro-manualroute.o macro-queryprogram.o macro-redirect.o \ + macro-auth-spa.o macro-cram_md5.o macro-cyrus_sasl.o macro-dovecot.o macro-gsasl_exim.o \ + macro-heimdal_gssapi.o macro-plaintext.o macro-spa.o macro-authtls.o macro-external.o \ + macro-dkim.o macro-malware.o macro-signing.o + +$(OBJ_MACRO): $(MACRO_HSRC) + +macro_predef.o : macro_predef.c + @echo "$(CC) -DMACRO_PREDEF macro_predef.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ macro_predef.c +macro-globals.o : globals.c + @echo "$(CC) -DMACRO_PREDEF globals.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ globals.c +macro-readconf.o : readconf.c + @echo "$(CC) -DMACRO_PREDEF readconf.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ readconf.c +macro-route.o : route.c + @echo "$(CC) -DMACRO_PREDEF route.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ route.c +macro-transport.o: transport.c + @echo "$(CC) -DMACRO_PREDEF transport.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transport.c +macro-drtables.o : drtables.c + @echo "$(CC) -DMACRO_PREDEF drtables.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ drtables.c +macro-acl.o: acl.c + @echo "$(CC) -DMACRO_PREDEF acl.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ acl.c +macro-tls.o: tls.c tls-gnu.c tls-openssl.c + @echo "$(CC) -DMACRO_PREDEF tls.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ tls.c +macro-appendfile.o : transports/appendfile.c + @echo "$(CC) -DMACRO_PREDEF transports/appendfile.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/appendfile.c +macro-autoreply.o : transports/autoreply.c + @echo "$(CC) -DMACRO_PREDEF transports/autoreply.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/autoreply.c +macro-lmtp.o: transports/lmtp.c + @echo "$(CC) -DMACRO_PREDEF transports/lmtp.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/lmtp.c +macro-pipe.o : transports/pipe.c + @echo "$(CC) -DMACRO_PREDEF transports/pipe.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/pipe.c +macro-queuefile.o : transports/queuefile.c + @echo "$(CC) -DMACRO_PREDEF transports/queuefile.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/queuefile.c +macro-smtp.o : transports/smtp.c + @echo "$(CC) -DMACRO_PREDEF transports/smtp.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ transports/smtp.c +macro-accept.o : routers/accept.c + @echo "$(CC) -DMACRO_PREDEF routers/accept.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/accept.c +macro-dnslookup.o : routers/dnslookup.c + @echo "$(CC) -DMACRO_PREDEF routers/dnslookup.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/dnslookup.c +macro-ipliteral.o : routers/ipliteral.c + @echo "$(CC) -DMACRO_PREDEF routers/ipliteral.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/ipliteral.c +macro-iplookup.o : routers/iplookup.c + @echo "$(CC) -DMACRO_PREDEF routers/iplookup.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/iplookup.c +macro-manualroute.o : routers/manualroute.c + @echo "$(CC) -DMACRO_PREDEF routers/manualroute.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/manualroute.c +macro-queryprogram.o : routers/queryprogram.c + @echo "$(CC) -DMACRO_PREDEF routers/queryprogram.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/queryprogram.c +macro-redirect.o : routers/redirect.c + @echo "$(CC) -DMACRO_PREDEF routers/redirect.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ routers/redirect.c +macro-auth-spa.o : auths/auth-spa.c + @echo "$(CC) -DMACRO_PREDEF auths/auth-spa.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/auth-spa.c +macro-cram_md5.o : auths/cram_md5.c + @echo "$(CC) -DMACRO_PREDEF auths/cram_md5.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/cram_md5.c +macro-cyrus_sasl.o : auths/cyrus_sasl.c + @echo "$(CC) -DMACRO_PREDEF auths/cyrus_sasl.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/cyrus_sasl.c +macro-dovecot.o: auths/dovecot.c + @echo "$(CC) -DMACRO_PREDEF auths/dovecot.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/dovecot.c +macro-external.o: auths/external.c + @echo "$(CC) -DMACRO_PREDEF auths/external.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/external.c +macro-gsasl_exim.o : auths/gsasl_exim.c + @echo "$(CC) -DMACRO_PREDEF auths/gsasl_exim.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/gsasl_exim.c +macro-heimdal_gssapi.o: auths/heimdal_gssapi.c + @echo "$(CC) -DMACRO_PREDEF auths/heimdal_gssapi.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/heimdal_gssapi.c +macro-plaintext.o : auths/plaintext.c + @echo "$(CC) -DMACRO_PREDEF auths/plaintext.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/plaintext.c +macro-spa.o : auths/spa.c + @echo "$(CC) -DMACRO_PREDEF auths/spa.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/spa.c +macro-authtls.o: auths/tls.c + @echo "$(CC) -DMACRO_PREDEF auths/tls.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ auths/tls.c +macro-dkim.o: dkim.c + @echo "$(CC) -DMACRO_PREDEF dkim.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ dkim.c +macro-malware.o: malware.c + @echo "$(CC) -DMACRO_PREDEF malware.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ malware.c +macro-signing.o: pdkim/signing.c + @echo "$(CC) -DMACRO_PREDEF pdkim/signing.c" + $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ pdkim/signing.c + +macro_predef: $(OBJ_MACRO) + @echo "$(LNCC) -o $@" + $(FE)$(LNCC) -o $@ $(LFLAGS) $(OBJ_MACRO) + +macro.c: macro_predef + ./macro_predef > macro.c + +# 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 config utils \ + buildauths buildlookups buildpdkim buildrouters \ + buildtransports checklocalmake clean + + +utils: $(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 + + +# Targets for special-purpose configuration header builders +buildconfig: buildconfig.c + @echo "$(CC) buildconfig.c" + $(FE)$(CC) $(CFLAGS) $(INCLUDE) -o buildconfig buildconfig.c $(LIBS) + + +# Target for the exicyclog utility script +exicyclog: config ../src/exicyclog.src + @rm -f exicyclog + @. ./version.sh && 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?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \ + -e "s?CHMOD_COMMAND?$(CHMOD_COMMAND)?" \ + -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \ + -e "s?MV_COMMAND?$(MV_COMMAND)?" \ + -e "s?RM_COMMAND?$(RM_COMMAND)?" \ + -e "s?TOUCH_COMMAND?$(TOUCH_COMMAND)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/exicyclog.src > exicyclog-t + @mv exicyclog-t exicyclog + @chmod a+x exicyclog + @echo ">>> exicyclog script built" + +# Target for the exinext utility script +exinext: config ../src/exinext.src + @rm -f exinext + @. ./version.sh && 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?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/exinext.src > exinext-t + @mv exinext-t exinext + @chmod a+x exinext + @echo ">>> exinext script built" + +# Target for the exiwhat utility script +exiwhat: config ../src/exiwhat.src + @rm -f exiwhat + @. ./version.sh && 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)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + -e "s?RM_COMMAND?$(RM_COMMAND)?" \ + ../src/exiwhat.src > exiwhat-t + @mv exiwhat-t exiwhat + @chmod a+x exiwhat + @echo ">>> exiwhat script built" + +# Target for the exim_checkaccess utility script +exim_checkaccess: config ../src/exim_checkaccess.src + @rm -f exim_checkaccess + @. ./version.sh && 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)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../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: config ../src/eximon.src ../OS/eximon.conf-Default \ + ../Local/eximon.conf + @rm -f eximon + $(SHELL) $(SCRIPTS)/Configure-eximon + @. ./version.sh && 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)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../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: config ../src/exigrep.src + @rm -f exigrep + @. ./version.sh && 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)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/exigrep.src > exigrep-t + @mv exigrep-t exigrep + @chmod a+x exigrep + @echo ">>> exigrep script built" + +eximstats: config ../src/eximstats.src + @rm -f eximstats + @. ./version.sh && sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/eximstats.src > eximstats-t + @mv eximstats-t eximstats + @chmod a+x eximstats + @echo ">>> eximstats script built" + +exiqgrep: config ../src/exiqgrep.src + @rm -f exiqgrep + @. ./version.sh && 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)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/exiqgrep.src > exiqgrep-t + @mv exiqgrep-t exiqgrep + @chmod a+x exiqgrep + @echo ">>> exiqgrep script built" + +exiqsumm: config ../src/exiqsumm.src + @rm -f exiqsumm + @. ./version.sh && sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/exiqsumm.src > exiqsumm-t + @mv exiqsumm-t exiqsumm + @chmod a+x exiqsumm + @echo ">>> exiqsumm script built" + +exipick: config ../src/exipick.src + @rm -f exipick + @. ./version.sh && sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \ + -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/exipick.src > exipick-t + @mv exipick-t exipick + @chmod a+x exipick + @echo ">>> exipick script built" + +transport-filter.pl: config ../src/transport-filter.src + @rm -f transport-filter.pl + @. ./version.sh && sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../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" + +convert4r3: config ../src/convert4r3.src + @rm -f convert4r3 + @. ./version.sh && sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/convert4r3.src > convert4r3-t + @mv convert4r3-t convert4r3 + @chmod a+x convert4r3 + @echo ">>> convert4r3 script built" + +convert4r4: config ../src/convert4r4.src + @rm -f convert4r4 + @. ./version.sh && sed \ + -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \ + -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \ + -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \ + ../src/convert4r4.src > convert4r4-t + @mv convert4r4-t convert4r4 + @chmod a+x convert4r4 + @echo ">>> convert4r4 script built" + + +# These are objects of optional features. They are always compiled, but +# if the corresponding #defines are not set, they wind up empty and +# are thrown away by the linker. + +OBJ_WITH_CONTENT_SCAN = malware.o mime.o regex.o spam.o spool_mbox.o +OBJ_EXPERIMENTAL = arc.o \ + bmi_spam.o \ + dane.o \ + dcc.o \ + dmarc.o \ + imap_utf7.o \ + spf.o \ + utf8.o + +# 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_LOOKUPS = lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o + +OBJ_EXIM = acl.o base64.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 dkim.o dkim_transport.o dnsbl.o hash.o \ + header.o host.o ip.o log.o lss.o match.o md5.o moan.o \ + os.o parse.o priv.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 \ + std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o \ + environment.o macro.o \ + $(OBJ_LOOKUPS) \ + local_scan.o $(EXIM_PERL) $(OBJ_WITH_CONTENT_SCAN) \ + $(OBJ_EXPERIMENTAL) + +exim: buildlookups buildauths pdkim/pdkim.a \ + buildrouters buildtransports \ + $(OBJ_EXIM) version.o + @echo "$(LNCC) -o exim" + $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \ + routers/routers.a transports/transports.a lookups/lookups.a \ + auths/auths.a pdkim/pdkim.a \ + $(LIBRESOLV) $(LIBS) $(LIBS_EXIM) $(IPV6_LIBS) $(EXTRALIBS) \ + $(EXTRALIBS_EXIM) $(DBMLIB) $(LOOKUP_LIBS) $(AUTH_LIBS) \ + $(PERL_LIBS) $(TLS_LIBS) $(PCRE_LIBS) $(LDFLAGS) + @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) + @echo "$(LNCC) -o exim_dumpdb" + $(FE)$(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 ">>> 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 util-md5.o + +exim_fixdb: $(OBJ_FIXDB) + @echo "$(LNCC) -o exim_fixdb" + $(FE)$(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 ">>> 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) + @echo "$(LNCC) -o exim_tidydb" + $(FE)$(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 ">>> exim_tidydb utility built" + @echo " " + +# The utility for building dbm files + +exim_dbmbuild: exim_dbmbuild.o + @echo "$(LNCC) -o exim_dbmbuild" + $(FE)$(LNCC) $(CFLAGS) $(INCLUDE) -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 ">>> exim_dbmbuild utility built" + @echo " " + +# The utility for locking a mailbox while messing around with it + +exim_lock: exim_lock.c os.h + @echo "$(CC) exim_lock.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) exim_lock.c + @echo "$(LNCC) -o exim_lock" + $(FE)$(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 ">>> 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 \ + util-queue.o \ + util-tod.o \ + util-tree.o \ + $(MONBIN) + +eximon.bin: $(EXIMON_EDITME) eximon $(OBJ_MONBIN) ../exim_monitor/em_version.c \ + mytypes.h store.h macros.h + @echo "$(CC) exim_monitor/em_version.c" + $(FE)$(CC) -o em_version.o -c \ + $(CFLAGS) $(XINCLUDE) -I. ../exim_monitor/em_version.c + @echo "$(LNCC) -o eximon.bin" + $(FE)$(PURIFY) $(LNCC) -o eximon.bin em_version.o $(LFLAGS) $(XLFLAGS) \ + $(OBJ_MONBIN) -lXaw -lXmu -lXt -lXext -lX11 $(PCRE_LIBS) \ + $(LIBS) $(LIBS_EXIMON) $(EXTRALIBS) $(EXTRALIBS_EXIMON) -lc + @if [ x"$(STRIP_COMMAND)" != x"" ]; then \ + echo $(STRIP_COMMAND) eximon.bin; \ + $(STRIP_COMMAND) eximon.bin; \ + fi + @echo ">>> exim monitor binary built" + @echo " " + + +# Compile step for most of the exim modules. HDRS is a list of headers +# which cause everything 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 = blob.h \ + config.h \ + dbfunctions.h \ + exim.h \ + functions.h \ + globals.h \ + hash.h \ + hintsdb.h \ + hintsdb_structs.h \ + local_scan.h \ + macros.h \ + mytypes.h \ + sha_ver.h \ + structs.h \ + os.h +PHDRS = ../config.h \ + ../dbfunctions.h \ + ../exim.h \ + ../functions.h \ + ../globals.h \ + ../hintsdb.h \ + ../hintsdb_structs.h \ + ../local_scan.h \ + ../macros.h \ + ../mytypes.h \ + ../structs.h \ + ../os.h + +.SUFFIXES: .o .c +.c.o:; @echo "$(CC) $*.c" + $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c + +# Update Exim's version information and build the version object. The dependency +# chain here avoids problems under parallel-make. + +version.sh: + @../scripts/reversion + +version.h: version.sh + +cnumber.h: version.h + +version.o: $(HDRS) cnumber.h version.h version.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 + @echo "$(PERL_CC) perl.c" + $(FE)$(PERL_CC) $(PERL_CCOPTS) $(CFLAGS) $(INCLUDE) -c perl.c + +# Compile instructions for the database utility modules + +exim_dumpdb.o: $(HDRS) exim_dbutil.c + @echo "$(CC) -DEXIM_DUMPDB exim_dbutil.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \ + -DCOMPILE_UTILITY \ + -DEXIM_DUMPDB \ + -o exim_dumpdb.o exim_dbutil.c + +exim_fixdb.o: $(HDRS) exim_dbutil.c + @echo "$(CC) -DEXIM_FIXDB exim_dbutil.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) \ + -DCOMPILE_UTILITY \ + -DEXIM_FIXDB \ + -o exim_fixdb.o exim_dbutil.c + +exim_tidydb.o: $(HDRS) exim_dbutil.c + @echo "$(CC) -DEXIM_TIDYDB exim_dbutil.c" + $(FE)$(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 + @echo "$(CC) exim_dbmbuild.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY \ + -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 + @echo "$(CC) -DCOMPILE_UTILITY spool_in.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-spool_in.o spool_in.c + +util-store.o: $(HDRS) store.c + @echo "$(CC) -DCOMPILE_UTILITY store.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-store.o store.c + +util-string.o: $(HDRS) string.c + @echo "$(CC) -DCOMPILE_UTILITY string.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-string.o string.c + +util-md5.o: $(HDRS) md5.c + @echo "$(CC) -DCOMPILE_UTILITY queue.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-md5.o md5.c + +util-queue.o: $(HDRS) queue.c + @echo "$(CC) -DCOMPILE_UTILITY queue.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-queue.o queue.c + +util-tod.o: $(HDRS) tod.c + @echo "$(CC) -DCOMPILE_UTILITY tod.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tod.o tod.c + +util-tree.o: $(HDRS) tree.c + @echo "$(CC) -DCOMPILE_UTILITY tree.c" + $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY -o util-tree.o tree.c + +util-os.o: $(HDRS) os.c + @echo "$(CC) -DCOMPILE_UTILITY os.c" + $(FE)$(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: config local_scan.h ../$(LOCAL_SCAN_SOURCE) + @echo "$(CC) local_scan.c" + $(FE)$(CC) -DLOCAL_SCAN -c $(CFLAGS) -I. $(INCLUDE) -o local_scan.o ../$(LOCAL_SCAN_SOURCE) + +# Dependencies for the "ordinary" exim modules + +acl.o: $(HDRS) acl.c +base64.o: $(HDRS) mime.h base64.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) transports/smtp.h deliver.c +directory.o: $(HDRS) directory.c +dns.o: $(HDRS) dns.c +dnsbl.o: $(HDRS) dnsbl.c +enq.o: $(HDRS) enq.c +exim.o: $(HDRS) exim.c +expand.o: $(HDRS) expand.c +environment.o: $(HDRS) environment.c +filter.o: $(HDRS) filter.c +filtertest.o: $(HDRS) filtertest.c +globals.o: $(HDRS) globals.c +hash.o: $(HDRS) hash.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 +md5.o: $(HDRS) md5.c +moan.o: $(HDRS) moan.c +os.o: $(HDRS) $(OS_C_INCLUDES) os.c +parse.o: $(HDRS) parse.c +priv.o: $(HDRS) priv.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 +std-crypto.o: $(HDRS) std-crypto.c +store.o: $(HDRS) store.c +string.o: $(HDRS) string.c +tls.o: $(HDRS) tls.c \ + tls-gnu.c tlscert-gnu.c \ + tls-openssl.c tlscert-openssl.c \ + tls-cipher-stdname.c +tod.o: $(HDRS) tod.c +transport.o: $(HDRS) transport.c +tree.o: $(HDRS) tree.c +verify.o: $(HDRS) transports/smtp.h verify.c +dkim.o: $(HDRS) pdkim/pdkim.h dkim.c +dkim_transport.o: $(HDRS) dkim_transport.c + +# Dependencies for WITH_CONTENT_SCAN modules + +malware.o: $(HDRS) malware.c +mime.o: $(HDRS) mime.h mime.c +regex.o: $(HDRS) regex.c +spam.o: $(HDRS) spam.c +spool_mbox.o: $(HDRS) spool_mbox.c + + +# Dependencies for EXPERIMENTAL_* modules + +arc.o: $(HDRS) pdkim/pdkim.h arc.c +bmi_spam.o: $(HDRS) bmi_spam.c +dane.o: $(HDRS) dane.c dane-openssl.c +dcc.o: $(HDRS) dcc.h dcc.c +dmarc.o: $(HDRS) pdkim/pdkim.h dmarc.h dmarc.c +imap_utf7.o: $(HDRS) imap_utf7.c +spf.o: $(HDRS) spf.h spf.c +utf8.o: $(HDRS) utf8.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 + +# We depend upon object files built as part of building the lookups library +# When using parallel make, we don't have the dependency to force building +# in the sub-directory unless we force that dependency: + +$(OBJ_LOOKUPS): buildlookups + +# 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) + @echo "$(CC) exim_monitor/$(@:.o=.c)" + $(FE)$(CC) -o $@ -c $(CFLAGS) -DCOMPILE_UTILITY -I. -I../exim_monitor $(INCLUDE) $(XINCLUDE) \ + ../exim_monitor/$(@:.o=.c) + + +# Targets for the various libraries that Exim uses. + +# The lookups library. + +buildlookups: config + @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \ + FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)" + @echo " " + +# The routers library. + +buildrouters: config + @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)" + @echo " " + +# The transports library. + +buildtransports: config + @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)" + @echo " " + +# The library of authorization modules + +buildauths: config + @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \ + INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)" + @echo " " + +# The PDKIM library + +buildpdkim: pdkim/pdkim.a +pdkim/pdkim.a: config + @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \ + FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" 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 utf8.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE dbfn.c + $(CC) -c $(CFLAGS) $(INCLUDE) -DCOMPILE_UTILITY store.c + $(LNCC) -o test_dbfn $(LFLAGS) dbfn.o \ + dummies.o sa-globals.o sa-os.o store.o string.o \ + tod.o version.o utf8.o $(LIBS) $(DBMLIB) $(LDFLAGS) + rm -f dbfn.o store.o + +test_host: config.h child.c host.c dns.c dummies.c sa-globals.o os.o \ + store.o string.o tod.o tree.o + $(CC) -c $(CFLAGS) $(INCLUDE) -DSTAND_ALONE -DTEST_HOST child.c + $(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 child.o dns.o dummies.o sa-globals.o os.o store.o string.o \ + tod.o tree.o $(LIBS) $(LIBRESOLV) + rm -f child.o dummies.o host.o dns.o + +test_os: os.h os.c dummies.o sa-globals.o store.o string.o tod.o utf8.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 utf8.o $(LIBS) $(LDFLAGS) + rm -f os.o + +test_parse: config.h parse.c dummies.o sa-globals.o \ + store.o string.o tod.o version.o utf8.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 \ + utf8.o $(LDFLAGS) + rm -f parse.o + +test_string: config.h string.c dummies.o sa-globals.o store.o tod.o utf8.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 utf8.o $(LIBS) $(LDFLAGS) + rm -f string.o + +# End diff --git a/OS/Makefile-Default b/OS/Makefile-Default new file mode 100644 index 0000000..6e42db4 --- /dev/null +++ b/OS/Makefile-Default @@ -0,0 +1,327 @@ +################################################## +# 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 +CHMOD_COMMAND=/usr/bin/chmod +MV_COMMAND=/bin/mv +RM_COMMAND=/bin/rm +TOUCH_COMMAND=/usr/bin/touch + + +# 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= + + +# PCRE_LIBS contains the library to be linked for PCRE + +PCRE_LIBS=-lpcre2-8 + + +# 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= + + +# 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 gradually spreading more and more widely. Most operating systems seem +# to support it nowadays. If you set this option, IPv6 support will be included +# in the Exim binary. As well as the basic enabling option, there are +# parameters for include and library directories that may be needed for IPv6 on +# some systems, where the support is not yet in the standard library. + +# HAVE_IPV6=YES +# IPV6_INCLUDE=-I /usr/ipv6/include +# IPV6_LIBS=-L/usr/ipv6/libs -linet6 + +# 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 + + +# If you want to use local_scan() at all, the support code must be included +# by uncommenting this line. + +# HAVE_LOCAL_SCAN=yes + +# 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 + +# A very simple example points to a template function that doesn't actually do +# any scanning, but just accepts the message. A compilable file must be +# included in the build even if HAVE_LOCAL_SCAN is not defined. + +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 variable 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/OS/Makefile-FreeBSD b/OS/Makefile-FreeBSD new file mode 100644 index 0000000..02253d9 --- /dev/null +++ b/OS/Makefile-FreeBSD @@ -0,0 +1,54 @@ +# Exim: OS-specific make file for FreeBSD +# Copyright (c) The Exim Maintainers 2020 + +CHOWN_COMMAND=/usr/sbin/chown +#STRIP_COMMAND=/usr/bin/strip +CHMOD_COMMAND=/bin/chmod + + +# FreeBSD Ports no longer insert compatibility symlinks into /usr/bin for +# scripting languages which traditionally have had them. +PERL_COMMAND=/usr/local/bin/perl + +HAVE_SA_LEN=YES + +# crypt() is in a separate library +LIBS=-lcrypt -lm -lutil + +# Dynamically loaded modules need to be built with -fPIC +CFLAGS_DYNAMIC=-shared -rdynamic -fPIC + +# FreeBSD always ships with Berkeley DB +USE_DB=yes + +# This code for building outside ports suggested by Richard Clayton +.ifdef X11BASE +X11=${X11BASE} +.elifdef LOCALBASE +X11=$(LOCALBASE) +.else +X11=/usr/local +.endif + +# nb: FreeBSD is entirely elf; objformat was removed prior to FreeBSD 7 +# http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/objformat/Attic/objformat.c +# deleted Jan 2007. +# +# So if this fails, you're on an ancient unsupported FreeBSD release *and* +# running GUI software, which seems both unusual and unwise. +# +# http://www.freebsd.org/doc/handbook/binary-formats.html suggests that the +# switch to default to ELF came with FreeBSD 3. elf(5) claims ELF support +# introduced in FreeBSD 2.2.6. +# +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib -Wl,-rpath,${X11}/lib +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/OS/Makefile-GNU b/OS/Makefile-GNU new file mode 100644 index 0000000..b49976f --- /dev/null +++ b/OS/Makefile-GNU @@ -0,0 +1,30 @@ +# Exim: OS-specific make file for GNU and variants. +# Copyright (c) The Exim Maintainers 2020 + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=look_for_it +CHGRP_COMMAND=look_for_it +CHMOD_COMMAND=look_for_it + +CFLAGS ?= -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + +DBMLIB = -ldb +USE_DB = yes + +LIBS = -lnsl -lcrypt -lm +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/OS/Makefile-Linux b/OS/Makefile-Linux new file mode 100644 index 0000000..dfb2fa8 --- /dev/null +++ b/OS/Makefile-Linux @@ -0,0 +1,39 @@ +# Exim: OS-specific make file for Linux. This is for modern Linuxes, +# which use libc6. +# Copyright (c) The Exim Maintainers 2020 +# +# For Linux, we assume GNU Make; at time of writing, the only extension +# used is ?= which is actually portable to other maintained Make variants, +# just is not POSIX. + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=look_for_it +CHGRP_COMMAND=look_for_it +CHMOD_COMMAND=look_for_it + +# The system cc may be gcc or clang; do not force gcc +CC=cc +# Preserve CFLAGS and CFLAGS_DYNAMIC from the caller/environment +CFLAGS ?= -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +CFLAGS_DYNAMIC ?= -shared -rdynamic + +DBMLIB = -ldb +USE_DB = yes + +LIBS = -lcrypt -lm +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/OS/Makefile-OpenBSD b/OS/Makefile-OpenBSD new file mode 100644 index 0000000..6976326 --- /dev/null +++ b/OS/Makefile-OpenBSD @@ -0,0 +1,30 @@ +# Exim: OS-specific make file for OpenBSD +# Copyright (c) The Exim Maintainers 2022 + +CHOWN_COMMAND=/usr/sbin/chown +CHGRP_COMMAND=/usr/sbin/chgrp +CHMOD_COMMAND=/bin/chmod + +CC=cc +CFLAGS=-O2 -Wall -Wno-parentheses -Wno-self-assign -Wno-logical-op-parentheses + +LIBS=-lm + +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 ships with a too-old Berkeley DB. NDBM is the default if we don't specify one. +#USE_DB=yes + +# End diff --git a/OS/Makefile-SunOS5 b/OS/Makefile-SunOS5 new file mode 100644 index 0000000..3b436f4 --- /dev/null +++ b/OS/Makefile-SunOS5 @@ -0,0 +1,24 @@ +# Exim: OS-specific make file for SunOS5 +# Copyright (c) The Exim Maintainers 2020 + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +HOSTNAME_COMMAND=look_for_it + +RANLIB=@true +LIBS=-lsocket -lnsl -lkstat -lm +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 + +OS_C_INCLUDES=setenv.c +CFLAGS += -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__ + +# End diff --git a/OS/eximon.conf-Default b/OS/eximon.conf-Default new file mode 100644 index 0000000..2f874ef --- /dev/null +++ b/OS/eximon.conf-Default @@ -0,0 +1,41 @@ +# 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<Btn1Down>'} +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/OS/os.Configuring b/OS/os.Configuring new file mode 100644 index 0000000..465bc26 --- /dev/null +++ b/OS/os.Configuring @@ -0,0 +1,215 @@ +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-<ostype> files +----------------------- + +There may be an os.c-<ostype> 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-<ostype> 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-<ostype> files +----------------------- + +For each OS that Exim knows about, there is an os.h-<ostype> file, where +<ostype> 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 and GNU Hurd. 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-<ostype>, 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-<ostype> 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 <sys/mount.h> + +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-<ostype> file, then the #include for this header is skipped in +exim.h. + +Support for login_cap functions +------------------------------- + +Some of the BSD systems support functions for controlling the resources that +user processes can use (e.g. login_getpwclass). If HAVE_SETCLASSRESOURCES is +defined, Exim supports this feature for running pipe deliveries, using the +setclassresources() function. + +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/OS/os.c-FreeBSD b/OS/os.c-FreeBSD new file mode 100644 index 0000000..02b7858 --- /dev/null +++ b/OS/os.c-FreeBSD @@ -0,0 +1,49 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) Jeremy Harris 1995 - 2020 */ +/* Copyright (c) The Exim Maintainers 2021 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* FreeBSD-specific code. This is concatenated onto the generic +src/os.c file. */ + + +/************* +Sendfile shim +*************/ + +ssize_t +os_sendfile(int out, int in, off_t * offp, size_t cnt) +{ +off_t loff = offp ? *offp : 0; +off_t written; + +if (sendfile(in, out, loff, cnt, NULL, &written, 0) < 0) return (ssize_t)-1; +if (offp) *offp = loff + written; +return (ssize_t)written; +} + +/************************************************* +TCP Fast Open: check that the ioctl is accepted +*************************************************/ + +#ifndef COMPILE_UTILITY +void +tfo_probe(void) +{ +# ifdef TCP_FASTOPEN +int sock; + +if ( (sock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 + && setsockopt(sock, IPPROTO_TCP, TCP_FASTOPEN, &on, sizeof(on) >= 0) + ) + f.tcp_fastopen_ok = TRUE; +close(sock); +# endif +} +#endif + + +/* End of os.c-Linux */ diff --git a/OS/os.c-GNU b/OS/os.c-GNU new file mode 100644 index 0000000..dbd0149 --- /dev/null +++ b/OS/os.c-GNU @@ -0,0 +1,56 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) The Exim Maintainers 2020 */ +/* 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 <mach.h> + +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/OS/os.c-Linux b/OS/os.c-Linux new file mode 100644 index 0000000..59d81f8 --- /dev/null +++ b/OS/os.c-Linux @@ -0,0 +1,165 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 1997 - 2018 */ +/* 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. */ + +#if !defined(OS_LOAD_AVERAGE) && defined(__linux__) +#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 <sys/sysinfo.h> + +static int +linux_slow_getloadavg(void) +{ +struct sysinfo s; +double avg; +if (sysinfo(&s) < 0) return -1; +avg = (double) (s.loads[0]) / (1<<SI_LOAD_SHIFT); +return (int)(avg * 1000.0); +} + +int +os_getloadavg(void) +{ +char buffer[40]; +double avg; +int count; +int fd = open ("/proc/loadavg", O_RDONLY); +if (fd == -1) return linux_slow_getloadavg(); +count = read (fd, buffer, sizeof(buffer)); +(void)close (fd); +if (count <= 0) return linux_slow_getloadavg(); +count = sscanf (buffer, "%lf", &avg); +if (count < 1) return linux_slow_getloadavg(); +return (int)(avg * 1000.0); +} +#endif /* OS_LOAD_AVERAGE */ + + + + + +/************************************************* +* Finding interface addresses * +*************************************************/ + +/* This function is not required for utilities; we cut it out if +FIND_RUNNING_INTERFACES is already defined. */ + +#ifndef FIND_RUNNING_INTERFACES + +/* This code, contributed by Jason Gunthorpe, appears to be the current +way of finding IPv6 interfaces in Linux. It first calls the common function in +order to find IPv4 interfaces, then grobbles around to find the others. Jason +said, "This is so horrible, don't look. Slightly ripped from net-tools +ifconfig." It gets called by virtue of os_find_running_interfaces being defined +as a macro for os_find_running_interfaces_linux in the os.h-Linux file. */ + +ip_address_item * +os_find_running_interfaces_linux(void) +{ +ip_address_item *yield = NULL; + +#if HAVE_IPV6 +ip_address_item *last = NULL; +ip_address_item *next; +char addr6p[8][5]; +unsigned int plen, scope, dad_status, if_idx; +char devname[20+1]; +FILE *f; +#endif + +yield = os_common_find_running_interfaces(); + +#if HAVE_IPV6 + +/* Open the /proc file; give up if we can't. */ + +if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) return yield; + +/* Pick out the data from within the file, and add it on to the chain */ + +last = yield; +if (last != NULL) while (last->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 */ + + +/************* +* Sendfile * +*************/ +#include <sys/sendfile.h> + +ssize_t +os_sendfile(int out, int in, off_t * off, size_t cnt) +{ +return sendfile(out, in, off, cnt); +} + +/* End of os.c-Linux */ diff --git a/OS/os.c-SunOS5 b/OS/os.c-SunOS5 new file mode 100644 index 0000000..1624869 --- /dev/null +++ b/OS/os.c-SunOS5 @@ -0,0 +1,16 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2016 */ +/* Copyright (c) Jeremy Harris 2016 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* Solaris-specific code. This is concatenated onto the generic +src/os.c file. */ + +#if defined(MISSING_UNSETENV_3) && !defined(COMPILE_UTILITY) +# include "setenv.c" +#endif + +/* End of os.c-SunOS5 */ diff --git a/OS/os.h-FreeBSD b/OS/os.h-FreeBSD new file mode 100644 index 0000000..06e217a --- /dev/null +++ b/OS/os.h-FreeBSD @@ -0,0 +1,81 @@ +/* Exim: OS-specific C header file for FreeBSD */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ +/* Copyright (c) The Exim Maintainers 2020 - 2021 */ +/* See the file NOTICE for conditions of use and distribution. */ + + +#include <sys/types.h> +#include <sys/param.h> + +#define HAVE_BSD_GETLOADAVG +#define HAVE_SETCLASSRESOURCES +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define HAVE_GETIFADDRS +#define SIOCGIFCONF_GIVES_ADDR +#define HAVE_SRANDOMDEV +#define HAVE_ARC4RANDOM +#define EXIM_HAVE_OPENAT +#define EXIM_HAVE_FUTIMENS + +/* Applications should not call arc4random_stir() explicitly after + * FreeBSD r227520 (approximately 1000002). + * Set NOT_HAVE_ARC4RANDOM_STIR if the version released is past + * that point. */ +#if __FreeBSD_version >= 1000002 +# define NOT_HAVE_ARC4RANDOM_STIR +#endif + +typedef struct flock flock_t; + +/* iconv arg2 type: libiconv in Ports uses "const char* * inbuf" and was + * traditionally the only approach available. The iconv functionality + * in libc is "char ** restrict src". + * + * <https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html> + * says that libc has iconv since 2013, in 10-CURRENT. FreeBSD man-pages + * shows it included in 10.0-RELEASE. Writing this in 2017, 10.3 is the + * oldest supported release, so we should assume non-libiconv by default. + * (Actually, people still using old releases past EOL; we shouldn't support + * them but I don't want to deal with howls of complaints because we dare + * to not support the unsupported, so guard this on FreeBSD 10+) + * + * Thus we no longer override iconv. + * + * However, if libiconv is installed, and anything adds /usr/local/include + * to include-path (likely) then we'll get that. So define a variable + * which makes the libiconv try to not interfere with OS iconv. + */ +#if __FreeBSD__ >= 10 +# define LIBICONV_PLUG +#endif +/* for more specific version constraints, look at __FreeBSD_version + * from <sys/param.h> */ + +/* When using DKIM, setting OS_SENDFILE can increase +performance on outgoing mail a bit. */ + +#define OS_SENDFILE +extern ssize_t os_sendfile(int, int, off_t *, size_t); + +#ifdef PID_T_FMT +# undef PID_T_FMT +#endif +#define PID_T_FMT "%d" + + +/*******************/ + +#define EXIM_TFO_PROBE +#define EXIM_TFO_FREEBSD + + +/* for TCP state-variable values, for TFO logging */ +#include <netinet/tcp_fsm.h> +#define TCP_SYN_RECV TCPS_SYN_RECEIVED + +/*******************/ + +#define EXIM_HAVE_KEVENT + +/* End */ diff --git a/OS/os.h-GNU b/OS/os.h-GNU new file mode 100644 index 0000000..4b22260 --- /dev/null +++ b/OS/os.h-GNU @@ -0,0 +1,34 @@ +/* Exim: OS-specific C header file for GNU/Hurd */ +/* Copyright (c) The Exim Maintainers 2020 - 2021 */ + +#include <features.h> + +#define CRYPT_H +#define GLIBC_IP_OPTIONS +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define SIG_IGN_WORKS +#define SIOCGIFCONF_GIVES_ADDR + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* Hurd-specific bits below */ + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* setgroups(0, NULL) succeeds, and drops the gid group +as well as any supplementary groups*/ +#define OS_SETGROUPS_ZERO_DROPS_ALL + +#if _POSIX_C_SOURCE >= 200809L || _ATFILE_SOURCE +# define EXIM_HAVE_OPENAT +#endif + +/* End */ diff --git a/OS/os.h-Linux b/OS/os.h-Linux new file mode 100644 index 0000000..e6a8d28 --- /dev/null +++ b/OS/os.h-Linux @@ -0,0 +1,104 @@ +/* Exim: OS-specific C header file for Linux */ +/* Copyright (c) University of Cambridge 1995 - 2020 */ +/* Copyright (c) The Exim Maintainers 2021 */ +/* See the file NOTICE for conditions of use and distribution. */ + + +/* Some old systems we've received bug-reports for have a <limits.h> which +does not pull in <features.h>. Best to just pull it in now and have done +with the issue. */ + +#include <features.h> +#include <sys/types.h> + + +#define CRYPT_H +#define GLIBC_IP_OPTIONS +#define HAVE_MMAP +#define HAVE_BSD_GETLOADAVG +#define HAVE_SYS_STATVFS_H +#define HAVE_GETIFADDRS +#define NO_IP_VAR_H +#define SIG_IGN_WORKS + +/* When using DKIM, setting OS_SENDFILE can increase +performance on outgoing mail a bit. Note: With older glibc versions +this setting will conflict with the _FILE_OFFSET_BITS=64 setting +defined as part of the Linux CFLAGS. As of 2017 those are declared +to be too old to build by default. */ + +#define OS_SENDFILE +extern ssize_t os_sendfile(int, int, off_t *, size_t); + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__) +# define SIOCGIFCONF_GIVES_ADDR +# define HAVE_SYS_MOUNT_H +#endif + +#if defined(__linux__) + +/* 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 + +#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); + +#endif /* __linux__ */ + +/* Some folks running "unusual" setups with very old libc environments have +found that _GNU_SOURCE=1 before <features.h> is not sufficient to define some +constants needed for 64-bit arithmetic. If you encounter build errors based +on LLONG_MIN being undefined and various other escape hatches have not helped, +then change the 0 to 1 in the next block. */ + +#if 0 +# define LLONG_MIN LONG_LONG_MIN +# define LLONG_MAX LONG_LONG_MAX +#endif + +#if _POSIX_C_SOURCE >= 200809L || _ATFILE_SOURCE +# define EXIM_HAVE_OPENAT +# define EXIM_HAVE_FUTIMENS +#endif + +/* TCP Fast Open support */ + +#include <netinet/tcp.h> /* for TCP_FASTOPEN */ +#include <sys/socket.h> /* for MSG_FASTOPEN */ +#if defined(TCP_FASTOPEN) && !defined(MSG_FASTOPEN) +# define MSG_FASTOPEN 0x20000000 +#endif +#define EXIM_HAVE_TCPI_UNACKED +#ifndef TCPI_OPT_SYN_DATA +# define TCPI_OPT_SYN_DATA 32 +#endif + +/* "Abstract" Unix-socket names */ +#define EXIM_HAVE_ABSTRACT_UNIX_SOCKETS + +/* inotify(7) etc syscalls */ +#define EXIM_HAVE_INOTIFY + +/* Needed for uClibc */ +#ifndef NS_MAXMSG +# define NS_MAXMSG 65535 +#endif + +/* End */ diff --git a/OS/os.h-OpenBSD b/OS/os.h-OpenBSD new file mode 100644 index 0000000..c690b6e --- /dev/null +++ b/OS/os.h-OpenBSD @@ -0,0 +1,65 @@ +/* Exim: OS-specific C header file for OpenBSD */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ +/* Copyright (c) The Exim Maintainers 2021 */ +/* See the file NOTICE for conditions of use and distribution. */ + + +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define HAVE_GETIFADDRS +#define EXIM_HAVE_OPENAT +#define EXIM_HAVE_FUTIMENS +#define HAVE_ARC4RANDOM +/* In May 2014, OpenBSD 5.5 was released which cleaned up the arc4random_* API + which removed the arc4random_stir() function. Set NOT_HAVE_ARC4RANDOM_STIR + if the version released is past that point. */ +#include <sys/param.h> +#if OpenBSD >= 201405 +# define NOT_HAVE_ARC4RANDOM_STIR +#endif + +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +typedef struct __res_state *res_state; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +#ifndef EPROTO +# define EPROTO 71 +#endif + +/* We need to force this; the automatic in buildconfig.c gets %ld */ +#ifdef OFF_T_FMT +# undef OFF_T_FMT +# undef LONGLONG_T +#endif +#define OFF_T_FMT "%lld" +#define LONGLONG_T long long int + +#ifdef PID_T_FMT +# undef PID_T_FMT +#endif +#define PID_T_FMT "%d" + +#ifdef INO_T_FMT +# undef INO_T_FMT +#endif +#define INO_T_FMT "%llu" + +#ifdef TIME_T_FMT +# undef TIME_T_FMT +#endif +#define TIME_T_FMT "%lld" + +/* seems arpa/nameser.h does not define this. +Space-constrained devices could use much smaller; a few k. */ +#define NS_MAXMSG 65535 + +#define EXIM_HAVE_KEVENT + +/* End */ diff --git a/OS/os.h-SunOS5 b/OS/os.h-SunOS5 new file mode 100644 index 0000000..7125321 --- /dev/null +++ b/OS/os.h-SunOS5 @@ -0,0 +1,58 @@ +/* Exim: OS-specific C header file for SunOS5 aka Solaris */ +/* Copyright (c) The Exim Maintainers 2021 */ + +#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 EXIM_HAVE_OPENAT +#define EXIM_HAVE_FUTIMENS + +#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 EXIM_SOCKLEN_T size_t */ + +/* This is different from Linux and all other PAM implementations, +it seems. */ + +#define PAM_CONVERSE_ARG2_TYPE struct pam_message + + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +#if _POSIX_C_SOURCE < 200112L +# define MISSING_UNSETENV_3 +#endif + +#if _POSIX_C_SOURCE < 200809L +# define MISSING_POSIX_MEMALIGN +#endif + + +/* SunOS5 doesn't accept getcwd(NULL, 0) to auto-allocate +a buffer */ + +#define OS_GETCWD + + +#ifndef MIN +# define MIN(a,b) (((a)<(b))?(a):(b)) +# define MAX(a,b) (((a)>(b))?(a):(b)) +#endif + +/* End */ diff --git a/OS/unsupported/Makefile-AIX b/OS/unsupported/Makefile-AIX new file mode 100644 index 0000000..fc32aa2 --- /dev/null +++ b/OS/unsupported/Makefile-AIX @@ -0,0 +1,28 @@ +# Exim: OS-specific make file for AIX +# Written by Nick Waterman (nick@cimio.co.uk) +# Modified by PH following a message from Mike Meredith + +# 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 cc compiler with AIX! + +CC=gcc + +# 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. +# Mike M says this is not necessary any more; possibly this is related to +# using gcc. Commented out by PH. +#CFLAGS = -D__STR31__ + +CFLAGS = -mcpu=power4 -maix64 -O3 + +# Needed for vfork() and vfork() only? + +LIBS = -lbsd -lm + +# End diff --git a/OS/unsupported/Makefile-BSDI b/OS/unsupported/Makefile-BSDI new file mode 100644 index 0000000..d56aa9b --- /dev/null +++ b/OS/unsupported/Makefile-BSDI @@ -0,0 +1,21 @@ +# Exim: OS-specific make file for BSDI aka BSD/OS. 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 -lm +EXIMON_TEXTPOP= + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/OS/unsupported/Makefile-CYGWIN b/OS/unsupported/Makefile-CYGWIN new file mode 100644 index 0000000..5e608fe --- /dev/null +++ b/OS/unsupported/Makefile-CYGWIN @@ -0,0 +1,113 @@ +# OS-specific file for Cygwin. + +# This file provided by Pierre A. Humblet <Pierre.Humblet@ieee.org> + +HAVE_IPV6 = yes +HAVE_ICONV = yes +# Use c99 to have %z +CFLAGS= -g -Wall -std=c99 -U __STRICT_ANSI__ +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 normally 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 + +#DISABLE_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 + +LDAP_LIB_TYPE=OPENLDAP2 +LOOKUP_LIBS=-lldap -llber + +WITH_CONTENT_SCAN=yes + +# It is important to define these variables but the values are always overridden +CONFIGURE_OWNER=18 +CONFIGURE_GROUP=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 + +# All modes are in octal and must start with 0 +EXIMDB_DIRECTORY_MODE = 01777 +EXIMDB_MODE = 0666 +EXIMDB_LOCKFILE_MODE = 0666 +INPUT_DIRECTORY_MODE = 01777 +LOG_DIRECTORY_MODE = 01777 +LOG_MODE = 0666 +MSGLOG_DIRECTORY_MODE = 01777 +SPOOL_DIRECTORY_MODE = 01777 +SPOOL_MODE = 0600 + +# End diff --git a/OS/unsupported/Makefile-DGUX b/OS/unsupported/Makefile-DGUX new file mode 100644 index 0000000..667c63f --- /dev/null +++ b/OS/unsupported/Makefile-DGUX @@ -0,0 +1,32 @@ +# 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 +CHMOD_COMMAND=/bin/chmod + +# 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 -lm +LIBRESOLV=-lresolv +DBMLIB=-ldbm + +# End + diff --git a/OS/unsupported/Makefile-Darwin b/OS/unsupported/Makefile-Darwin new file mode 100644 index 0000000..517bbc4 --- /dev/null +++ b/OS/unsupported/Makefile-Darwin @@ -0,0 +1,33 @@ +# Exim: OS-specific make file for Darwin (Mac OS X). + +CC=cc + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=/usr/sbin/chown +CHMOD_COMMAND=/bin/chmod + +HAVE_SA_LEN=YES + +# Removed -DBIND_8_COMPAT for 4.61 +# CFLAGS=-O -no-cpp-precomp -DBIND_8_COMPAT +# +# 2020/05/12 disable TLS resume support; it results in +# "1 select() failure: No such file or directory" +# being logged by the daeomn (sending the testsuite red...) + +CFLAGS=-O -no-cpp-precomp -DDISABLE_TLS_RESUME +LIBRESOLV=-lresolv + +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/OS/unsupported/Makefile-DragonFly b/OS/unsupported/Makefile-DragonFly new file mode 100644 index 0000000..c49c59f --- /dev/null +++ b/OS/unsupported/Makefile-DragonFly @@ -0,0 +1,31 @@ +# Exim: OS-specific make file for DragonFly +# There's no setting of CFLAGS here, to allow the system default +# for "make" to be the default. + +CHOWN_COMMAND=/usr/sbin/chown +CHMOD_COMMAND=/bin/chmod + +HAVE_SA_LEN=YES + +# crypt() is in a separate library +LIBS=-lcrypt -lm + +# DragonFly always ships with Berkeley DB +USE_DB=yes + +# X11 may be under /usr/pkg/xorg/ for example. +# X11=/usr/X11R6 +X11=$(X11BASE) + +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +XLFLAGS+=-Wl,-rpath,${X11BASE}/lib +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/OS/unsupported/Makefile-GNUkFreeBSD b/OS/unsupported/Makefile-GNUkFreeBSD new file mode 100644 index 0000000..8019281 --- /dev/null +++ b/OS/unsupported/Makefile-GNUkFreeBSD @@ -0,0 +1,29 @@ +# Exim: OS-specific make file for GNU and variants. + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=look_for_it +CHGRP_COMMAND=look_for_it +CHMOD_COMMAND=look_for_it + +CFLAGS ?= -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + +DBMLIB = -ldb +USE_DB = yes + +LIBS = -lnsl -lcrypt -lm +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=exim4 +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/OS/unsupported/Makefile-GNUkNetBSD b/OS/unsupported/Makefile-GNUkNetBSD new file mode 100644 index 0000000..8019281 --- /dev/null +++ b/OS/unsupported/Makefile-GNUkNetBSD @@ -0,0 +1,29 @@ +# Exim: OS-specific make file for GNU and variants. + +HAVE_ICONV=yes + +BASENAME_COMMAND=look_for_it +CHOWN_COMMAND=look_for_it +CHGRP_COMMAND=look_for_it +CHMOD_COMMAND=look_for_it + +CFLAGS ?= -O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + +DBMLIB = -ldb +USE_DB = yes + +LIBS = -lnsl -lcrypt -lm +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=exim4 +EXIWHAT_KILL_SIGNAL=-USR1 + +# End diff --git a/OS/unsupported/Makefile-HI-OSF b/OS/unsupported/Makefile-HI-OSF new file mode 100644 index 0000000..da3d487 --- /dev/null +++ b/OS/unsupported/Makefile-HI-OSF @@ -0,0 +1,8 @@ +# 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/OS/unsupported/Makefile-HI-UX b/OS/unsupported/Makefile-HI-UX new file mode 100644 index 0000000..870ee84 --- /dev/null +++ b/OS/unsupported/Makefile-HI-UX @@ -0,0 +1,12 @@ +# 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/OS/unsupported/Makefile-HP-UX b/OS/unsupported/Makefile-HP-UX new file mode 100644 index 0000000..ea35144 --- /dev/null +++ b/OS/unsupported/Makefile-HP-UX @@ -0,0 +1,27 @@ +# Exim: OS-specific make file for HP-UX later than 9 + +# HP ANSI C compiler +#CC=cc +#CFLAGS=+O2 +Onolimit -z -D_XOPEN_SOURCE_EXTENDED +# Users of the A.06.00 compiler might need to use +O1 rather than +O2 as +# there have been some problems reported with this compiler with +O2 set. + +# gcc +CFLAGS=-O -D_XOPEN_SOURCE_EXTENDED +LDFLAGS=-Wl,-z +LIBS=-lm + +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 + +OS_C_INCLUDES=setenv.c + +# End diff --git a/OS/unsupported/Makefile-HP-UX-9 b/OS/unsupported/Makefile-HP-UX-9 new file mode 100644 index 0000000..1530009 --- /dev/null +++ b/OS/unsupported/Makefile-HP-UX-9 @@ -0,0 +1,15 @@ +# 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/OS/unsupported/Makefile-IRIX b/OS/unsupported/Makefile-IRIX new file mode 100644 index 0000000..7b95783 --- /dev/null +++ b/OS/unsupported/Makefile-IRIX @@ -0,0 +1,12 @@ +# 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 -lm +XINCLUDE=-I/usr/include/X11 +vfork=fork +RANLIB=@true + +# End diff --git a/OS/unsupported/Makefile-IRIX6 b/OS/unsupported/Makefile-IRIX6 new file mode 100644 index 0000000..be01138 --- /dev/null +++ b/OS/unsupported/Makefile-IRIX6 @@ -0,0 +1,13 @@ +# 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 -lm +XINCLUDE=-I/usr/include/X11 +XLFLAGS= +vfork=fork +RANLIB=@true + +# End diff --git a/OS/unsupported/Makefile-IRIX632 b/OS/unsupported/Makefile-IRIX632 new file mode 100644 index 0000000..b567fc6 --- /dev/null +++ b/OS/unsupported/Makefile-IRIX632 @@ -0,0 +1,16 @@ +# 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 -lm +XINCLUDE=-I/usr/include/X11 +vfork=fork +RANLIB=@true + +# End diff --git a/OS/unsupported/Makefile-IRIX65 b/OS/unsupported/Makefile-IRIX65 new file mode 100644 index 0000000..50e7745 --- /dev/null +++ b/OS/unsupported/Makefile-IRIX65 @@ -0,0 +1,16 @@ +# 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 -lm +XINCLUDE=-I/usr/include/X11 +vfork=fork +RANLIB=@true + +# End diff --git a/OS/unsupported/Makefile-NetBSD b/OS/unsupported/Makefile-NetBSD new file mode 100644 index 0000000..35d03a2 --- /dev/null +++ b/OS/unsupported/Makefile-NetBSD @@ -0,0 +1,27 @@ +# Exim: OS-specific make file for NetBSD (ELF object format) + +CHOWN_COMMAND=/usr/sbin/chown +CHMOD_COMMAND=/bin/chmod + +CFLAGS ?= -O2 + +HAVE_SA_LEN=YES +HAVE_IPV6=YES +LIBS=-lcrypt -lm + +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/OS/unsupported/Makefile-NetBSD-a.out b/OS/unsupported/Makefile-NetBSD-a.out new file mode 100644 index 0000000..e210efd --- /dev/null +++ b/OS/unsupported/Makefile-NetBSD-a.out @@ -0,0 +1,24 @@ +# Exim: OS-specific make file for NetBSD (a.out/COFF object format) + +CHOWN_COMMAND=/usr/sbin/chown +CHMOD_COMMAND=/bin/chmod + +CFLAGS ?= -O2 + +HAVE_SA_LEN=YES +HAVE_IPV6=YES +LIBS=-lcrypt -lm + +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/OS/unsupported/Makefile-OSF1 b/OS/unsupported/Makefile-OSF1 new file mode 100644 index 0000000..811ca07 --- /dev/null +++ b/OS/unsupported/Makefile-OSF1 @@ -0,0 +1,10 @@ +# Exim: OS-specific make file for OSF1 + +CFLAGS=-O +LIBS=-liconv -lm +HAVE_CRYPT16=yes +HAVE_ICONV=yes +HOSTNAME_COMMAND=/usr/bin/hostname +EXIWHAT_EGREP_ARG='/exim( |$$)' + +# End diff --git a/OS/unsupported/Makefile-OpenUNIX b/OS/unsupported/Makefile-OpenUNIX new file mode 100644 index 0000000..e4d7261 --- /dev/null +++ b/OS/unsupported/Makefile-OpenUNIX @@ -0,0 +1,17 @@ +# 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 -lm +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/OS/unsupported/Makefile-QNX b/OS/unsupported/Makefile-QNX new file mode 100644 index 0000000..3cf81c4 --- /dev/null +++ b/OS/unsupported/Makefile-QNX @@ -0,0 +1,30 @@ +# Exim: OS-specific makefile for QNX + +BASENAME_COMMAND=/bin/basename +MAKE_SHELL=/usr/bin/bash + +CHOWN_COMMAND=/bin/chown +CHGRP_COMMAND=/bin/chgrp +CHMOD_COMMAND=/bin/chmod +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 -lm + +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib +X11_LD_LIB=$(X11)/lib + +# End diff --git a/OS/unsupported/Makefile-SCO b/OS/unsupported/Makefile-SCO new file mode 100644 index 0000000..baa61d8 --- /dev/null +++ b/OS/unsupported/Makefile-SCO @@ -0,0 +1,28 @@ +# 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 -lm +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 +CHMOD_COMMAND=/bin/chmod +HOSTNAME_COMMAND=/usr/bin/hostname +TOUCH_COMMAND=/bin/touch + +# End diff --git a/OS/unsupported/Makefile-SCO_SV b/OS/unsupported/Makefile-SCO_SV new file mode 100644 index 0000000..249b81a --- /dev/null +++ b/OS/unsupported/Makefile-SCO_SV @@ -0,0 +1,34 @@ +# 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 <tonye@ilion.nl> + +# 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 -lsocket -lm + +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 +CHMOD_COMMAND=/bin/chmod +HOSTNAME_COMMAND=/usr/bin/hostname +TOUCH_COMMAND=/bin/touch + +# End diff --git a/OS/unsupported/Makefile-SunOS4 b/OS/unsupported/Makefile-SunOS4 new file mode 100644 index 0000000..c876998 --- /dev/null +++ b/OS/unsupported/Makefile-SunOS4 @@ -0,0 +1,16 @@ +# Exim: OS-specific make file for SunOS4 + +CFLAGS=-O + +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/OS/unsupported/Makefile-SunOS5-hal b/OS/unsupported/Makefile-SunOS5-hal new file mode 100644 index 0000000..05ea893 --- /dev/null +++ b/OS/unsupported/Makefile-SunOS5-hal @@ -0,0 +1,18 @@ +# 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 -lm +LIBRESOLV=-lresolv +X11=/usr/X11R6 +XINCLUDE=-I$(X11)/include +XLFLAGS=-L$(X11)/lib -R$(X11)/lib + +# End diff --git a/OS/unsupported/Makefile-ULTRIX b/OS/unsupported/Makefile-ULTRIX new file mode 100644 index 0000000..9e912b3 --- /dev/null +++ b/OS/unsupported/Makefile-ULTRIX @@ -0,0 +1,18 @@ +# 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/OS/unsupported/Makefile-UNIX_SV b/OS/unsupported/Makefile-UNIX_SV new file mode 100644 index 0000000..bfcfae1 --- /dev/null +++ b/OS/unsupported/Makefile-UNIX_SV @@ -0,0 +1,24 @@ +# 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 -lm + +X11=/usr/lib/X11 +XINCLUDE=-I/usr/include/X11 +XLFLAGS=-L/usr/lib -L$(X11)/lib + +# End diff --git a/OS/unsupported/Makefile-USG b/OS/unsupported/Makefile-USG new file mode 100644 index 0000000..753a2d7 --- /dev/null +++ b/OS/unsupported/Makefile-USG @@ -0,0 +1,33 @@ +# 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 -lm + +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/OS/unsupported/Makefile-Unixware7 b/OS/unsupported/Makefile-Unixware7 new file mode 100644 index 0000000..88a8838 --- /dev/null +++ b/OS/unsupported/Makefile-Unixware7 @@ -0,0 +1,32 @@ +# Exim: OS-specific make file for Unixware7 +# Based on information from James FitzGibbon <james@ehlo.com> + +# 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 -lm + +# 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/OS/unsupported/Makefile-mips b/OS/unsupported/Makefile-mips new file mode 100644 index 0000000..ff33139 --- /dev/null +++ b/OS/unsupported/Makefile-mips @@ -0,0 +1,16 @@ +# Exim: OS-specific make file for RiscOS4bsd + +HOSTNAME_COMMAND=/usr/ucb/hostname +EXIT_FAILURE=1 +EXIT_SUCCESS=0 +LIBRESOLV=-lresolv +LIBS=-liberty -lm +XINCLUDE=-I/usr/X11R6/include + +CFLAGS=-O + +EXIWHAT_PS_ARG=-ax +EXIWHAT_EGREP_ARG='/exim( |$$)' +EXIWHAT_KILL_SIGNAL=-30 + +# End diff --git a/OS/unsupported/README b/OS/unsupported/README new file mode 100644 index 0000000..73790ae --- /dev/null +++ b/OS/unsupported/README @@ -0,0 +1,14 @@ +Files in this directory are historical. They may have worked once but the +project has no assurance that they still do. + +If you need to use one for a build for your platform, copy it up one directory +level first. We'll reinstate it given a current version and evidence of testing. +For the latter please look into the project regression testsuite, and please +consider operating a buildfarm animal in the long term (it runs the testsuite). + +The buildfarm status page is: + https://buildfarm.exim.org/cgi-bin/show_status.pl +There's a "register" link there with a link to how-to instructions. Please do +monitor the status of your animal on an ongoing basis. The exim-users or +exim-dev mailinglist are good places to ask for help and to discuss any regressions +seen in test runs. There is also the #exim IRC channel on Freenode. diff --git a/OS/unsupported/os.c-BSDI b/OS/unsupported/os.c-BSDI new file mode 100644 index 0000000..03a7a1c --- /dev/null +++ b/OS/unsupported/os.c-BSDI @@ -0,0 +1,19 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) 2016 Heiko Schlittermann <hs@schlittermann.de> */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* BSDI-specific code. This is concatenated onto the generic +src/os.c file. */ + +#ifndef OS_UNSETENV +#define OS_UNSETENV + +int +os_unsetenv(const uschar * name) +{ +unsetenv(CS name); +return 0; +} diff --git a/OS/unsupported/os.c-HI-OSF b/OS/unsupported/os.c-HI-OSF new file mode 100644 index 0000000..5e3d336 --- /dev/null +++ b/OS/unsupported/os.c-HI-OSF @@ -0,0 +1,35 @@ +/************************************************* +* 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 <sys/table.h> + +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/OS/unsupported/os.c-HP-UX b/OS/unsupported/os.c-HP-UX new file mode 100644 index 0000000..fdd8708 --- /dev/null +++ b/OS/unsupported/os.c-HP-UX @@ -0,0 +1,16 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2016 */ +/* Copyright (c) Jeremy Harris 2016 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* HP-UX-specific code. This is concatenated onto the generic +src/os.c file. */ + +#ifndef COMPILE_UTILITY +# include "setenv.c" +#endif + +/* End of os.c-SunHP-UX */ diff --git a/OS/unsupported/os.c-IRIX b/OS/unsupported/os.c-IRIX new file mode 100644 index 0000000..1917238 --- /dev/null +++ b/OS/unsupported/os.c-IRIX @@ -0,0 +1,119 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) The Exim Maintainers 2022 */ +/* 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 <sys/sysctl.h> +#include <net/if_dl.h> +#include <net/if_types.h> +#include <net/soioctl.h> +#include <net/route.h> + +#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, GET_UNTAINTED); + +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 = CS 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/OS/unsupported/os.c-IRIX6 b/OS/unsupported/os.c-IRIX6 new file mode 100644 index 0000000..1917238 --- /dev/null +++ b/OS/unsupported/os.c-IRIX6 @@ -0,0 +1,119 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) The Exim Maintainers 2022 */ +/* 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 <sys/sysctl.h> +#include <net/if_dl.h> +#include <net/if_types.h> +#include <net/soioctl.h> +#include <net/route.h> + +#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, GET_UNTAINTED); + +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 = CS 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/OS/unsupported/os.c-IRIX632 b/OS/unsupported/os.c-IRIX632 new file mode 100644 index 0000000..1917238 --- /dev/null +++ b/OS/unsupported/os.c-IRIX632 @@ -0,0 +1,119 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) The Exim Maintainers 2022 */ +/* 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 <sys/sysctl.h> +#include <net/if_dl.h> +#include <net/if_types.h> +#include <net/soioctl.h> +#include <net/route.h> + +#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, GET_UNTAINTED); + +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 = CS 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/OS/unsupported/os.c-IRIX65 b/OS/unsupported/os.c-IRIX65 new file mode 100644 index 0000000..1917238 --- /dev/null +++ b/OS/unsupported/os.c-IRIX65 @@ -0,0 +1,119 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) The Exim Maintainers 2022 */ +/* 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 <sys/sysctl.h> +#include <net/if_dl.h> +#include <net/if_types.h> +#include <net/soioctl.h> +#include <net/route.h> + +#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, GET_UNTAINTED); + +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 = CS 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/OS/unsupported/os.c-OSF1 b/OS/unsupported/os.c-OSF1 new file mode 100644 index 0000000..ad91b63 --- /dev/null +++ b/OS/unsupported/os.c-OSF1 @@ -0,0 +1,36 @@ +/************************************************* +* 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 <sys/table.h> + +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/OS/unsupported/os.c-cygwin b/OS/unsupported/os.c-cygwin new file mode 100644 index 0000000..5ca05a8 --- /dev/null +++ b/OS/unsupported/os.c-cygwin @@ -0,0 +1,531 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Cygwin-specific code. December 2002. Updated Jan 2015. + This is prefixed to the src/os.c file. + + This code was supplied by Pierre A. Humblet <Pierre.Humblet@ieee.org> +*/ + +/* 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); +} + +#ifndef COMPILE_UTILITY /* Utilities don't need special code */ + +#ifdef INCLUDE_PAM +#include "../pam/pam.c" +#endif +#include <alloca.h> + +unsigned int cygwin_WinVersion; + +/* Conflict between Windows definitions and others */ +#ifdef NOERROR +#undef NOERROR +#endif +#ifdef DELETE +#undef DELETE +#endif + +#include <windows.h> +#include <ntstatus.h> +#include <lmcons.h> + +#define EqualLuid(Luid1, Luid2) \ + ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart)) +#include <sys/cygwin.h> + +/* Special static variables */ +static BOOL cygwin_debug = FALSE; +static int fakesetugid = 1; /* when not privileged, setugid = noop */ + +#undef setuid +int cygwin_setuid(uid_t uid ) +{ + int res = 0; + if (fakesetugid == 0) { + res = setuid(uid); + if (cygwin_debug) + fprintf(stderr, "setuid %u %u %d pid: %d\n", + uid, getuid(),res, getpid()); + } + return res; +} + +#undef setgid +int cygwin_setgid(gid_t gid ) +{ + int res = 0; + if (fakesetugid == 0) { + res = setgid(gid); + if (cygwin_debug) + fprintf(stderr, "setgid %u %u %d pid: %d\n", + gid, getgid(), res, getpid()); + } + return res; +} + +/* Background processes run at lower priority */ +static void cygwin_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, +}; + +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 (EqualLuid(privs->Privileges[i].Luid, cluid)) + ret |= CREATE_BIT; + if (ret == (CREATE_BIT)) + break; + } + } + else + fprintf(stderr, "has_create_token_privilege %u\n", GetLastError()); + + if (hToken) + CloseHandle(hToken); + + return ret; +} + +/* + We use cygwin_premain to fake a few things + and to provide some debug info +*/ +void cygwin_premain2(int argc, char ** argv, struct per_process * ptr) +{ + int i, res, is_daemon = 0, is_spoolwritable, is_privileged, is_eximuser; + uid_t myuid, systemuid; + gid_t mygid, adminsgid; + struct passwd * pwp = NULL; + struct stat buf; + char *cygenv; + 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') { + ssize_t size; + wchar_t *win32_path; + argv[i][1] = 'n'; /* Replace -c by -n */ + cygwin_debug = TRUE; + fprintf(stderr, "CYGWIN = \"%s\".\n", cygenv); + if (((size = cygwin_conv_path(CCP_POSIX_TO_WIN_W,"/", win32_path, 0)) > 0) + && ((win32_path = store_malloc(size)) != NULL) + && (cygwin_conv_path(CCP_POSIX_TO_WIN_W,"/", win32_path, size) == 0)) { + fprintf(stderr, " Root / mapped to %ls.\n", win32_path); + store_free(win32_path); + } + } + else if (argv[i][1] == 'b' && argv[i][2] == 'd') { + is_daemon = 1; + cygwin_setpriority(); + } + } + } + + /* Nt/2000/XP + We initially set the exim uid & gid to those of the "exim user", + 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 allow exim imposed restrictions (bypassable by recompiling) + and to avoid exec that cause loss of privilege + If not privileged and unable to chown, + we set the exim uid to our uid. + If unprivileged and /var/spool/exim is writable and not running as listening daemon, + we fake all subsequent setuid. */ + + /* Get the system and admins uid from their sids */ + if ((systemuid = cygwin_internal(CW_GET_UID_FROM_SID, & SystemSid)) == -1) { + fprintf(stderr, "Cannot map System sid. Aborting\n"); + exit(1); + } + if ((adminsgid = cygwin_internal(CW_GET_GID_FROM_SID, & AdminsSid)) == -1) { + fprintf(stderr, "Cannot map Admins sid. Aborting\n"); + exit(1); + } + + priv_flags = get_privileges (); + is_privileged = !!(priv_flags & CREATE_BIT); + + /* Call getpwnam for account exim after getting the local exim name */ + char exim_username[DNLEN + UNLEN + 2]; + if (cygwin_internal(CW_CYGNAME_FROM_WINNAME, "exim", exim_username, sizeof exim_username) != 0) + pwp = getpwnam (exim_username); + + /* If cannot setuid to exim or and is not the daemon (which is assumed to be + able to chown or to be the exim user) set the exim ugid to our ugid to avoid + chown failures after creating files and to be able to setuid to exim in + exim.c ( "privilege not needed" ). */ + if ((is_privileged == 0) && (!is_daemon)) { + exim_uid = myuid; + exim_gid = mygid; + } + else if (pwp != NULL) { + exim_uid = pwp->pw_uid; /* Set it according to passwd */ + exim_gid = pwp->pw_gid; + is_eximuser = 1; + } + else { + exim_uid = systemuid; + exim_gid = adminsgid; + is_eximuser = 0; + } + + res = stat("/var/spool/exim", &buf); + /* Check if writable (and can be stat) */ + is_spoolwritable = ((res == 0) && ((buf.st_mode & S_IWOTH) != 0)); + + fakesetugid = (is_privileged == 0) && (is_daemon == 0) && (is_spoolwritable == 1); + + if (is_privileged) { /* Can setuid */ + if (cygwin_setgid(exim_gid) /* Setuid to exim */ + || cygwin_setuid(exim_uid)) { + fprintf(stderr, "Unable to setuid/gid to exim. priv_flags: %x\n", priv_flags); + exit(0); /* Problem... Perhaps not in 544 */ + } + } + + /* Set the configuration file uid and gid to the system uid and admins gid. */ + config_uid = systemuid; + config_gid = adminsgid; + + /* Pretend we are root to avoid useless exec + and avoid exim set limitations. + We are limited by file access rights */ + root_uid = getuid (); + + if (cygwin_debug) { + fprintf(stderr, "Starting uid %u, gid %u, priv_flags %x, is_privileged %d, is_daemon %d, is_spoolwritable %d.\n", + myuid, mygid, priv_flags, is_privileged, is_daemon, is_spoolwritable); + fprintf(stderr, "root_uid %u, exim_uid %u, exim_gid %u, config_uid %u, config_gid %u, is_eximuser %d.\n", + root_uid, exim_uid, exim_gid, config_uid, config_gid, is_eximuser); + } + return; +} + +#ifndef OS_LOAD_AVERAGE /* Can be set on command line */ +#define OS_LOAD_AVERAGE /* src/os.c need not provide it */ + +/***************************************************************** + Functions for average load measurements + + Uses NtQuerySystemInformation. + This requires definitions that are not part of + standard include files. + + This is discouraged starting with WinXP. + +*************************************************************/ +/* Structure to compute the load average efficiently */ +typedef struct { + DWORD Lock; + unsigned long long Time100ns; /* Last measurement time */ + unsigned long long IdleCount; /* Latest cumulative idle time */ + unsigned long long LastCounter; /* Last measurement counter */ + unsigned long long PerfFreq; /* Perf counter frequency */ + int LastLoad; /* Last reported load, or -1 */ +} cygwin_perf_t; + +static struct { + HANDLE handle; + pid_t pid; + cygwin_perf_t *perf; +} cygwin_load = {NULL, 0, NULL}; + +#include <ntdef.h> + +typedef enum _SYSTEM_INFORMATION_CLASS +{ + SystemBasicInformation = 0, + SystemPerformanceInformation = 2, + SystemTimeOfDayInformation = 3, + SystemProcessesAndThreadsInformation = 5, + SystemProcessorTimes = 8, + SystemPagefileInformation = 18, + /* There are a lot more of these... */ +} SYSTEM_INFORMATION_CLASS; + +typedef struct _SYSTEM_BASIC_INFORMATION +{ + ULONG Unknown; + ULONG MaximumIncrement; + ULONG PhysicalPageSize; + ULONG NumberOfPhysicalPages; + ULONG LowestPhysicalPage; + ULONG HighestPhysicalPage; + ULONG AllocationGranularity; + ULONG LowestUserAddress; + ULONG HighestUserAddress; + ULONG ActiveProcessors; + UCHAR NumberProcessors; +} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION; + +typedef struct __attribute__ ((aligned (8))) _SYSTEM_PROCESSOR_TIMES +{ + LARGE_INTEGER IdleTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; + LARGE_INTEGER DpcTime; + LARGE_INTEGER InterruptTime; + ULONG InterruptCount; +} SYSTEM_PROCESSOR_TIMES, *PSYSTEM_PROCESSOR_TIMES; + +typedef NTSTATUS NTAPI (*NtQuerySystemInformation_t) (SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); +typedef ULONG NTAPI (*RtlNtStatusToDosError_t) (NTSTATUS); + +static NtQuerySystemInformation_t NtQuerySystemInformation; +static RtlNtStatusToDosError_t RtlNtStatusToDosError; + +/***************************************************************** + * + LoadNtdll() + Load special functions from the NTDLL + Return TRUE if success. + + *****************************************************************/ + +static BOOL LoadNtdll() +{ + HINSTANCE hinstLib; + + if ((hinstLib = LoadLibrary("NTDLL.DLL")) + && (NtQuerySystemInformation = + (NtQuerySystemInformation_t) GetProcAddress(hinstLib, + "NtQuerySystemInformation")) + && (RtlNtStatusToDosError = + (RtlNtStatusToDosError_t) GetProcAddress(hinstLib, + "RtlNtStatusToDosError"))) + return TRUE; + + DEBUG(D_load) + debug_printf("perf: load: %u (Windows)\n", GetLastError()); + return FALSE; +} +/***************************************************************** + * + ReadStat() + Measures current Time100ns and IdleCount + Return TRUE if success. + + *****************************************************************/ + +static BOOL ReadStat(unsigned long long int *Time100nsPtr, + unsigned long long int *IdleCountPtr) +{ + NTSTATUS ret; + SYSTEM_BASIC_INFORMATION sbi; + PSYSTEM_PROCESSOR_TIMES spt; + + *Time100nsPtr = *IdleCountPtr = 0; + + if ((ret = NtQuerySystemInformation(SystemBasicInformation, + (PVOID) &sbi, sizeof sbi, NULL)) + != STATUS_SUCCESS) { + DEBUG(D_load) + debug_printf("Perf: NtQuerySystemInformation: %u (Windows)\n", + RtlNtStatusToDosError(ret)); + } + else if (!(spt = (PSYSTEM_PROCESSOR_TIMES) alloca(sizeof(spt[0]) * sbi.NumberProcessors))) { + DEBUG(D_load) + debug_printf("Perf: alloca: errno %d (%s)\n", errno, strerror(errno)); + } + else if ((ret = NtQuerySystemInformation(SystemProcessorTimes, (PVOID) spt, + sizeof spt[0] * sbi.NumberProcessors, NULL)) + != STATUS_SUCCESS) { + DEBUG(D_load) + debug_printf("Perf: NtQuerySystemInformation: %u (Windows)\n", + RtlNtStatusToDosError(ret)); + } + else { + int i; + for (i = 0; i < sbi.NumberProcessors; i++) { + *Time100nsPtr += spt[i].KernelTime.QuadPart;; + *Time100nsPtr += spt[i].UserTime.QuadPart; + *IdleCountPtr += spt[i].IdleTime.QuadPart; + } + return TRUE; + } + return FALSE; +} + +/***************************************************************** + * + InitLoadAvg() + Initialize the cygwin_load.perf structure. + and set cygwin_load.perf->Flag to TRUE if successful. + This is called the first time os_getloadavg is called + *****************************************************************/ +static void InitLoadAvg(cygwin_perf_t *this) +{ + BOOL success = TRUE; + + /* Get perf frequency and counter */ + QueryPerformanceFrequency((LARGE_INTEGER *)& this->PerfFreq); + QueryPerformanceCounter((LARGE_INTEGER *)& this->LastCounter); + + /* Get initial values for Time100ns and IdleCount */ + success = success + && ReadStat( & this->Time100ns, + & this->IdleCount); + /* If success, set the Load to 0, else to -1 */ + if (success) this->LastLoad = 0; + else { + log_write(0, LOG_MAIN, "Cannot obtain Load Average"); + this->LastLoad = -1; + } +} + + +/***************************************************************** + * + 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 initial load cannot be measured as we use the processor 100% +*****************************************************************/ +static SECURITY_ATTRIBUTES sa = {sizeof (SECURITY_ATTRIBUTES), NULL, TRUE}; +#define AVERAGING 10 + +int os_getloadavg() +{ + unsigned long long Time100ns, IdleCount, CurrCounter; + int value; + pid_t newpid; + + /* New process. + Reload the dlls and the file mapping */ + if ((newpid = getpid()) != cygwin_load.pid) { + BOOL new; + cygwin_load.pid = newpid; + + if (!LoadNtdll()) { + log_write(0, LOG_MAIN, "Cannot obtain Load Average"); + cygwin_load.perf = NULL; + return -1; + } + + if ((new = !cygwin_load.handle)) { + cygwin_load.handle = CreateFileMapping (INVALID_HANDLE_VALUE, &sa, PAGE_READWRITE, + 0, sizeof(cygwin_perf_t), NULL); + DEBUG(D_load) + debug_printf("Perf: CreateFileMapping: handle %p\n", (void *) cygwin_load.handle); + } + cygwin_load.perf = (cygwin_perf_t *) MapViewOfFile (cygwin_load.handle, + FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0); + DEBUG(D_load) + debug_printf("Perf: MapViewOfFile: addr %p\n", (void *) cygwin_load.perf); + if (new && cygwin_load.perf) + InitLoadAvg(cygwin_load.perf); + } + + /* Check if initialized OK */ + if (!cygwin_load.perf || cygwin_load.perf->LastLoad < 0) + return -1; + + /* If we cannot get the lock, we return 0. + This is to prevent any lock-up possibility. + Finding a lock busy is unlikely, and giving up only + results in an immediate delivery .*/ + + if (InterlockedCompareExchange(&cygwin_load.perf->Lock, 1, 0)) { + DEBUG(D_load) + debug_printf("Perf: Lock busy\n"); + return 0; + } + + /* Get the current time (PerfCounter) */ + QueryPerformanceCounter((LARGE_INTEGER *)& CurrCounter); + /* Calls closer than AVERAGING sec apart use the previous value */ + if (CurrCounter - cygwin_load.perf->LastCounter > + AVERAGING * cygwin_load.perf->PerfFreq) { + /* Get Time100ns and IdleCount */ + if (ReadStat( & Time100ns, & IdleCount)) { /* Success */ + /* Return processor load on 1000 scale */ + value = 1000 - ((1000 * (IdleCount - cygwin_load.perf->IdleCount)) / + (Time100ns - cygwin_load.perf->Time100ns)); + cygwin_load.perf->Time100ns = Time100ns; + cygwin_load.perf->IdleCount = IdleCount; + cygwin_load.perf->LastCounter = CurrCounter; + cygwin_load.perf->LastLoad = value; + DEBUG(D_load) + debug_printf("Perf: New load average %d\n", 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.perf->LastLoad = -1; + } + } + else + DEBUG(D_load) + debug_printf("Perf: Old load average %d\n", cygwin_load.perf->LastLoad); + cygwin_load.perf->Lock = 0; + return cygwin_load.perf->LastLoad; +} +#endif /* OS_LOAD_AVERAGE */ +#endif /* COMPILE_UTILITY */ diff --git a/OS/unsupported/os.h-AIX b/OS/unsupported/os.h-AIX new file mode 100644 index 0000000..5cd4501 --- /dev/null +++ b/OS/unsupported/os.h-AIX @@ -0,0 +1,27 @@ +/* Exim: OS-specific C header file for AIX */ +/* Written by Nick Waterman <nick@cimio.co.uk> */ +/* Modified by Philip Hazel with data from + Niels Provos <provos@wserver.physnet.uni-hamburg.de> + Juozas Simkevicius <juozas@omnitel.net> 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; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + + +/* End */ diff --git a/OS/unsupported/os.h-BSDI b/OS/unsupported/os.h-BSDI new file mode 100644 index 0000000..a1705ec --- /dev/null +++ b/OS/unsupported/os.h-BSDI @@ -0,0 +1,15 @@ +/* Exim: OS-specific C header file for BSDI */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_SETCLASSRESOURCES +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR +#define OS_UNSETENV + +typedef struct flock flock_t; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-DGUX b/OS/unsupported/os.h-DGUX new file mode 100644 index 0000000..9040f0e --- /dev/null +++ b/OS/unsupported/os.h-DGUX @@ -0,0 +1,28 @@ +/* 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 + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-Darwin b/OS/unsupported/os.h-Darwin new file mode 100644 index 0000000..a85e92f --- /dev/null +++ b/OS/unsupported/os.h-Darwin @@ -0,0 +1,64 @@ +/* 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 EXIM_HAVE_OPENAT + + +#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 + +/* Need this for the DNS lookup code. Remember to remove if we get round to +updating Exim to use the newer interface. */ + +#define BIND_8_COMPAT + +/* It's not .so for dynamic libraries on Darwin. */ +#define DYNLIB_FN_EXT "dylib" + +/* We currently need some assistance getting OFF_T_FMT correct on MacOS */ +#ifdef OFF_T_FMT +# undef OFF_T_FMT +#endif +#define OFF_T_FMT "%lld" +#define LONGLONG_T long int + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* seems arpa/nameser.h does not define this */ +#define NS_MAXMSG 65535 + +/* There may be very many supplementary groups for the user. See notes +in "man 2 getgroups". */ +#define _DARWIN_UNLIMITED_GETGROUPS +#define EXIM_GROUPLIST_SIZE 64 + +/* TCP Fast Open: Darwin uses a connectx() call +rather than a modified sendto() */ +#define EXIM_TFO_CONNECTX + +/* MacOS, at least on the buildfarm animal, does not seem to push out +the SMTP response to QUIT with our usual handling which is trying to get +the client to FIN first so that the server does not get the TIME_WAIT */ +#define SERVERSIDE_CLOSE_NOWAIT + +/* End */ diff --git a/OS/unsupported/os.h-DragonFly b/OS/unsupported/os.h-DragonFly new file mode 100644 index 0000000..4c2f1d5 --- /dev/null +++ b/OS/unsupported/os.h-DragonFly @@ -0,0 +1,13 @@ +/* Exim: OS-specific C header file for DragonFly */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +typedef struct flock flock_t; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-GNUkFreeBSD b/OS/unsupported/os.h-GNUkFreeBSD new file mode 100644 index 0000000..ab35031 --- /dev/null +++ b/OS/unsupported/os.h-GNUkFreeBSD @@ -0,0 +1,25 @@ +/* Exim: OS-specific C header file for GNU/kFreeBSD */ + +#define CRYPT_H +#define GLIBC_IP_OPTIONS +#define HAVE_MMAP +#define HAVE_BSD_GETLOADAVG +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define SIG_IGN_WORKS + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* kFreeBSD-specific bits below */ + +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-GNUkNetBSD b/OS/unsupported/os.h-GNUkNetBSD new file mode 100644 index 0000000..bc3bc25 --- /dev/null +++ b/OS/unsupported/os.h-GNUkNetBSD @@ -0,0 +1,25 @@ +/* Exim: OS-specific C header file for GNU/kNetBSD */ + +#define CRYPT_H +#define GLIBC_IP_OPTIONS +#define HAVE_MMAP +#define HAVE_BSD_GETLOADAVG +#define HAVE_SYS_VFS_H +#define NO_IP_VAR_H +#define SIG_IGN_WORKS + +#define F_FREESP O_TRUNC +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +/* kNetBSD-specific bits below */ + +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-HI-OSF b/OS/unsupported/os.h-HI-OSF new file mode 100644 index 0000000..0f50fb6 --- /dev/null +++ b/OS/unsupported/os.h-HI-OSF @@ -0,0 +1,12 @@ +/* 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 * + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-HI-UX b/OS/unsupported/os.h-HI-UX new file mode 100644 index 0000000..f3df963 --- /dev/null +++ b/OS/unsupported/os.h-HI-UX @@ -0,0 +1,21 @@ +/* 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; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-HP-UX b/OS/unsupported/os.h-HP-UX new file mode 100644 index 0000000..4998734 --- /dev/null +++ b/OS/unsupported/os.h-HP-UX @@ -0,0 +1,34 @@ +/* Exim: OS-specific C header file for HP-UX versions greater than 9 */ + +#define EXIM_SOCKLEN_T size_t + +#define LOAD_AVG_NEEDS_ROOT +#define HAVE_DEV_KMEM +#define LOAD_AVG_TYPE double +#define LOAD_AVG_SYMBOL "avenrun" +#define KERNEL_PATH "/stand/vmunix" +#define FSCALE 1.0 + +#define HAVE_SYS_STATVFS_H + +#define F_FREESP O_TRUNC +#define NEED_H_ERRNO 1 + +typedef struct flock flock_t; + +typedef struct __res_state *res_state; + +#define LLONG_MIN LONG_LONG_MIN +#define LLONG_MAX LONG_LONG_MAX + +#define strtoll(a,b,c) strtoimax(a,b,c) + +/* Determined by sockaddr_un */ + +struct sockaddr_storage +{ + short ss_family; + char __ss_padding[92]; +}; + +/* End */ diff --git a/OS/unsupported/os.h-HP-UX-9 b/OS/unsupported/os.h-HP-UX-9 new file mode 100644 index 0000000..5a260d6 --- /dev/null +++ b/OS/unsupported/os.h-HP-UX-9 @@ -0,0 +1,23 @@ +/* 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; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-IRIX b/OS/unsupported/os.h-IRIX new file mode 100644 index 0000000..1d4bf46 --- /dev/null +++ b/OS/unsupported/os.h-IRIX @@ -0,0 +1,17 @@ +/* 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 + +/* End */ diff --git a/OS/unsupported/os.h-IRIX6 b/OS/unsupported/os.h-IRIX6 new file mode 100644 index 0000000..bf30767 --- /dev/null +++ b/OS/unsupported/os.h-IRIX6 @@ -0,0 +1,16 @@ +/* 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 + +/* End */ diff --git a/OS/unsupported/os.h-IRIX632 b/OS/unsupported/os.h-IRIX632 new file mode 100644 index 0000000..90f1c58 --- /dev/null +++ b/OS/unsupported/os.h-IRIX632 @@ -0,0 +1,18 @@ +/* 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 + +/* End */ diff --git a/OS/unsupported/os.h-IRIX65 b/OS/unsupported/os.h-IRIX65 new file mode 100644 index 0000000..4b248fe --- /dev/null +++ b/OS/unsupported/os.h-IRIX65 @@ -0,0 +1,16 @@ +/* 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 + +/* End */ diff --git a/OS/unsupported/os.h-NetBSD b/OS/unsupported/os.h-NetBSD new file mode 100644 index 0000000..0b9fc03 --- /dev/null +++ b/OS/unsupported/os.h-NetBSD @@ -0,0 +1,31 @@ +/* Exim: OS-specific C header file for NetBSD */ +/* Copyright (c) The Exim Maintainers 2021 */ + +#define HAVE_BSD_GETLOADAVG +#define HAVE_GETIFADDRS +#define HAVE_MMAP +#define HAVE_SYS_MOUNT_H +#define SIOCGIFCONF_GIVES_ADDR +#define HAVE_ARC4RANDOM + +typedef struct flock flock_t; + +#define os_strsignal strsignal +#define OS_STRSIGNAL + +#define os_get_dns_resolver_res __res_get_state +#define os_put_dns_resolver_res(RP) __res_put_state(RP) +#define OS_GET_DNS_RESOLVER_RES + +#include <sys/param.h> + +#if __NetBSD_Version__ >= 299000900 +#define HAVE_SYS_STATVFS_H +#endif + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +#define EXIM_HAVE_KEVENT + +/* End */ diff --git a/OS/unsupported/os.h-NetBSD-a.out b/OS/unsupported/os.h-NetBSD-a.out new file mode 100644 index 0000000..29a8fee --- /dev/null +++ b/OS/unsupported/os.h-NetBSD-a.out @@ -0,0 +1,5 @@ +/* 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/OS/unsupported/os.h-OSF1 b/OS/unsupported/os.h-OSF1 new file mode 100644 index 0000000..6b5fa49 --- /dev/null +++ b/OS/unsupported/os.h-OSF1 @@ -0,0 +1,16 @@ +/* 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 + +/* This was here for some time, but it seems that now (June 2005) things have +changed. */ +/* #define EXIM_SOCKLEN_T size_t */ + +/* Still not "socklen_t", which is the most common setting */ +#define EXIM_SOCKLEN_T int + +/* End */ diff --git a/OS/unsupported/os.h-OpenUNIX b/OS/unsupported/os.h-OpenUNIX new file mode 100644 index 0000000..67d1063 --- /dev/null +++ b/OS/unsupported/os.h-OpenUNIX @@ -0,0 +1,19 @@ +/* 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 + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-QNX b/OS/unsupported/os.h-QNX new file mode 100644 index 0000000..798f799 --- /dev/null +++ b/OS/unsupported/os.h-QNX @@ -0,0 +1,24 @@ +/* Exim: OS-specific C header file for QNX */ +/* Modified for QNX 6.2.0 with diffs from Samuli Tuomola. */ + +#include <sys/select.h> + +/* 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 <unix.h> +#endif + +#undef HAVE_STATFS +#undef HAVE_VFS_H +#undef HAVE_SYS_MOUNT_H + +#define NO_SYSEXITS + +extern int h_errno; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-SCO b/OS/unsupported/os.h-SCO new file mode 100644 index 0000000..e5e915e --- /dev/null +++ b/OS/unsupported/os.h-SCO @@ -0,0 +1,21 @@ +/* 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 EXIM_SOCKLEN_T int + +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define _SVID3 +#define NEED_H_ERRNO + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-SCO_SV b/OS/unsupported/os.h-SCO_SV new file mode 100644 index 0000000..0ca29f7 --- /dev/null +++ b/OS/unsupported/os.h-SCO_SV @@ -0,0 +1,19 @@ +/* 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 EXIM_SOCKLEN_T int + +#define HAVE_SYS_STATVFS_H +#define F_FAVAIL f_favail +#define _SVID3 +#define NEED_H_ERRNO + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-SunOS4 b/OS/unsupported/os.h-SunOS4 new file mode 100644 index 0000000..6555620 --- /dev/null +++ b/OS/unsupported/os.h-SunOS4 @@ -0,0 +1,39 @@ +/* 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 + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-SunOS5-hal b/OS/unsupported/os.h-SunOS5-hal new file mode 100644 index 0000000..cd9e877 --- /dev/null +++ b/OS/unsupported/os.h-SunOS5-hal @@ -0,0 +1,14 @@ +/* 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 + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-ULTRIX b/OS/unsupported/os.h-ULTRIX new file mode 100644 index 0000000..08db5ae --- /dev/null +++ b/OS/unsupported/os.h-ULTRIX @@ -0,0 +1,18 @@ +/* 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; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-UNIX_SV b/OS/unsupported/os.h-UNIX_SV new file mode 100644 index 0000000..4943a07 --- /dev/null +++ b/OS/unsupported/os.h-UNIX_SV @@ -0,0 +1,25 @@ +/* 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 + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-USG b/OS/unsupported/os.h-USG new file mode 100644 index 0000000..e769220 --- /dev/null +++ b/OS/unsupported/os.h-USG @@ -0,0 +1,19 @@ +/* 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 + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-Unixware7 b/OS/unsupported/os.h-Unixware7 new file mode 100644 index 0000000..4d3ed42 --- /dev/null +++ b/OS/unsupported/os.h-Unixware7 @@ -0,0 +1,18 @@ +/* Exim: OS-specific C header file for Unixware 7 */ + +#define NO_SYSEXITS + +#define EXIM_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/OS/unsupported/os.h-cygwin b/OS/unsupported/os.h-cygwin new file mode 100644 index 0000000..6ef59e0 --- /dev/null +++ b/OS/unsupported/os.h-cygwin @@ -0,0 +1,41 @@ +/* Exim: OS-specific C header file for Cygwin */ + +/* This code was supplied by Pierre A. Humblet <Pierre.Humblet@ieee.org> + December 2002. Updated Jan 2015. */ + +/* Redefine the set*id calls to run when faking root */ +#include <unistd.h> /* 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 + +#define os_strsignal strsignal +#define OS_STRSIGNAL +#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 +/* 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}} + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ diff --git a/OS/unsupported/os.h-mips b/OS/unsupported/os.h-mips new file mode 100644 index 0000000..325e3a1 --- /dev/null +++ b/OS/unsupported/os.h-mips @@ -0,0 +1,27 @@ +/* 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[]; + +/* default is non-const */ +#define ICONV_ARG2_TYPE const char ** + +/* End */ |