Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postfix/   (Postfix Mailserver Version 3.11©)  Datei vom 5.2.2026 mit Größe 42 kB image not shown  

Quelle  makedefs   Sprache: unbekannt

 
#!/bin/sh

# To view the formatted manual page of this file, type:
#       POSTFIXSOURCE/mantools/srctoman - makedefs | nroff -man

#++
# NAME
# makedefs 1
# SUMMARY
# Postfix makefile configuration utility
# SYNOPSIS
# \fBmake makefiles \fIname=value...\fR
# DESCRIPTION
# The \fBmakedefs\fR command identifies the compilation
# environment, and emits macro definitions on the standard
# output stream that can be prepended to template Makefiles.
# These macros implement an internal interface and are subject
# to change without notice.
# NAME=VALUE OVERRIDES
# .ad
# .fi
# Default settings can be overruled by specifying them as
# environment variables (or as name=value pairs on the "make"
# command line). Use quotes if variables contain whitespace
# or shell meta characters.
#
# The command "\fBmake makefiles name=value...\fR" will replace
# the string \fBMAIL_VERSION\fR at the end of a value with the
# Postfix version (\fImajor.minor.patchlevel\fR for a stable
# release, \fImajor.minor-date\fR for a development release).
# Do not try to specify something like \fB$mail_version\fR:
# that produces inconsistent results with different implementations
# of the make(1) command.
# .IP \fBAUXLIBS=\fIobject_library...\fR
# Specifies one or more non-default object libraries. Postfix
3.0 and later specify some of their database library
# dependencies with AUXLIBS_CDB, AUXLIBS_LDAP, AUXLIBS_LMDB,
# AUXLIBS_MONGODB,
# AUXLIBS_MYSQL, AUXLIBS_PCRE, AUXLIBS_PGSQL, AUXLIBS_SDBM,
# and AUXLIBS_SQLITE, respectively.
# .IP \fBCC=\fIcompiler_command\fR
# Specifies a non-default compiler. On many systems, the default
# is \fBgcc\fR.
# .IP \fBCCARGS=\fIcompiler_arguments\fR
# Specifies non-default compiler arguments, for example, a non-default
# \fIinclude\fR directory.
# The following directives are special:
# .RS
# .IP \fB-DNO_CLOSEFROM\fR
# Do not use the system closefom() implementation.
# .IP \fB-DNO_DB\fR
# Do not build with Berkeley DB support.
# .IP \fB-DNO_DEVPOLL\fR
# Do not build with Solaris /dev/poll support.
# By default, /dev/poll support is compiled in on platforms that
# are known to support it.
# .IP \fB-DNO_DNSSEC\fR
# Do not build with DNSSEC support, even if the resolver
# library appears to support it.
# .IP \fB-DNO_EPOLL\fR
# Do not build with Linux EPOLL support.
# By default, EPOLL support is compiled in on platforms that
# are known to support it.
# .IP \fB-DNO_EAI\fR
# Do not build with EAI (SMTPUTF8) support. By default, EAI
# support is compiled in when the "pkgconf" or "pkg-config"
# command are
# found, or the deprecated "icu-config" command.
# .IP \fB-DNO_INLINE\fR
# Do not require support for C99 "inline" functions. Instead,
# implement argument typechecks for non-(printf/scanf)-like
# functions with ternary operators and unreachable code.
# .IP \fB-DNO_IPV6\fR
# Do not build with IPv6 support.
# By default, IPv6 support is compiled in on platforms that
# are known to have IPv6 support.
#
# Note: this directive is for debugging and testing only. It
# is not guaranteed to work on all platforms. If you don't
# want IPv6 support, set "inet_protocols = ipv4" in main.cf.
# .IP \fB-DNO_IP_CYRUS_SASL_AUTH\fR
# Don't pass remote SMTP client and Postfix SMTP server IP
# address and port information to the Cyrus SASL library.
# This is compatible with Postfix < 3.2.
# .IP \fB-DNO_KQUEUE\fR
# Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE support.
# By default, KQUEUE support is compiled in on platforms that
# are known to support it.
# .IP \fB-DNO_NIS\fR
# Do not build with NIS or NISPLUS support. Support for NIS
# is unavailable on some recent Linux distributions.
# .IP \fB-DNO_NISPLUS\fR
# Do not build with NISPLUS support. Support for NISPLUS
# is unavailable on some recent Solaris distributions.
# .IP \fB-DNO_PCRE\fR
# Do not build with PCRE support.
# By default, PCRE support is compiled in when the \fBpcre2-config\fR
# or \fBpcre-config\fR utility are installed.
# .IP \fB-DNO_POSIX_GETPW_R\fR
# Disable support for POSIX getpwnam_r/getpwuid_r.
# .IP \fB-DNO_RES_NCALLS\fR
# Do not build with the threadsafe resolver(5) API (res_ninit() etc.).
# .IP \fB-DNO_SIGSETJMP\fR
# Use setjmp()/longjmp() instead of sigsetjmp()/siglongjmp().
# By default, Postfix uses sigsetjmp()/siglongjmp() when they
# appear to work.
# .IP \fB-DNO_SNPRINTF\fR
# Use sprintf() instead of snprintf(). By default, Postfix
# uses snprintf() except on ancient systems.
# .IP \fB-DNO_STDBOOL\fR
# Don't use <stdbool.h>. This is usually auto-detected.
# .RE
# .IP \fBDEBUG=\fIdebug_level\fR
# Specifies a non-default debugging level. The default is \fB-g\fR.
# Specify \fBDEBUG=\fR to turn off debugging.
# .IP \fBOPT=\fIoptimization_level\fR
# Specifies a non-default optimization level. The default is \fB-O\fR.
# Specify \fBOPT=\fR to turn off optimization.
# .IP \fBPOSTFIX_INSTALL_OPTS=\fI-option...\fR
# Specifies options for the postfix-install command, separated
# by whitespace. Currently, the only supported option is
# \fB-keep-build-mtime\fR.
# .IP \fBSHLIB_CFLAGS=\fIflags\fR
# Override the compiler flags (typically, "-fPIC") for Postfix
# dynamically-linked libraries and database plugins.
#
# This feature was introduced with Postfix 3.0.
# .IP \fBSHLIB_RPATH=\fIrpath\fR
# Override the runpath (typically, "'-Wl,-rpath,${SHLIB_DIR}'")
# for Postfix dynamically-linked libraries.
#
# This feature was introduced with Postfix 3.0.
# .IP \fBSHLIB_SUFFIX=\fIsuffix\fR
# Override the filename suffix (typically, ".so") for Postfix
# dynamically-linked libraries and database plugins.
#
# This feature was introduced with Postfix 3.0.
# .IP \fBshared=yes\fR
# .IP \fBshared=no\fR
# Enable (disable) Postfix builds with dynamically-linked
# libraries typically named $shlib_directory/libpostfix-*.so.*.
#
# This feature was introduced with Postfix 3.0.
# .IP \fBdynamicmaps=yes\fR
# .IP \fBdynamicmaps=no\fR
# Enable (disable) Postfix builds with the configuration file
# $meta_directory/dynamicmaps.cf and dynamically-loadable
# database plugins typically named postfix-*.so.*.  The setting
# "dynamicmaps=yes" implicitly enables Postfix dynamically-linked
# libraries.
#
# This feature was introduced with Postfix 3.0.
# .IP \fBpie=yes\fR
# .IP \fBpie=no\fR
# Enable (disable) Postfix builds with position-independent
# executables, on platforms where this is supported.
#
# This feature was introduced with Postfix 3.0.
# .IP \fIinstallation_parameter\fB=\fIvalue\fR...
# Override the compiled-in default value of the specified
# installation parameter(s). The following parameters are
# supported in this context:
#
# command_directory config_directory daemon_directory
# data_directory default_cache_db_type default_database_type
# html_directory mail_spool_directory mailq_path manpage_directory
# meta_directory newaliases_path queue_directory readme_directory
# sendmail_path shlib_directory openssl_path
#
# See the postconf(5) manpage for a description of these
# parameters.
#
# This feature was introduced with Postfix 3.0.
# .IP \fBWARN=\fIwarning_flags\fR
# Specifies non-default gcc compiler warning options for use when
# "make" is invoked in a source subdirectory only.
# LICENSE
# .ad
# .fi
# The Secure Mailer license must be distributed with this software.
# AUTHOR(S)
# Wietse Venema
# IBM T.J. Watson Research
# P.O. Box 704
# Yorktown Heights, NY 10598, USA
#
# Wietse Venema
# Google, Inc.
111 8th Avenue
# New York, NY 10011, USA
#--

# Override all LC_* settings and LANG for reproducibility.
LC_ALL=C; export LC_ALL

# By now all shells must have functions.

error() {
   # Alas, tput(1) is not portable so we can't use visual effects.
   echo "ATTENTION:" 1>&2;
   echo "ATTENTION:" $* 1>&2;
   echo "ATTENTION:" 1>&2;
   exit 1
}

# First, deal with unsupported usage.
case "$LD_LIBRARY_PATH" in
?*) error "Not supported: building with LD_LIBRARY_PATH";;
esac

env | grep '^AUXLIBS_' | while read line
do
    case  "$line" in
*-lpostfix-*) error "Not supported: linking plugins with -lpostfix-*: $line";;
    esac
done || exit 1

# Suggest a fix for systems without grep -E or -F flags.
(echo foo | grep -E foo 2>/dev/null | grep -F foo >/dev/null 2>/dev/null) || 
    error "No grep -[EF] support. See auxiliary/fix-grep for a conversion tool."

# Emit system-dependent Makefile macro definitions to standard output.

echo "#----------------------------------------------------------------"
echo "# Start of summary of user-configurable 'make makefiles' options."
echo "# CCARGS=$CCARGS"
echo "# AUXLIBS=$AUXLIBS"
env | grep '^AUXLIBS_' | sed 's/^/# /' | sort
echo "# shared=$shared"
echo "# dynamicmaps=$dynamicmaps"
echo "# pie=$pie"

# Defaults for most sane systems

RANLIB=ranlib
SYSLIBS=
AR=ar
ARFL=rv

# Ugly function to make our error message more visible among the
# garbage that is output by some versions of make(1).

case $# in
 # Officially supported usage.
 0) SYSTEM=`(uname -s) 2>/dev/null`
    RELEASE=`(uname -r) 2>/dev/null`
    VERSION=`(uname -v) 2>/dev/null`
    case "$VERSION" in
     dcosx*) SYSTEM=$VERSION;;
    esac;;
 # Unsupported debug-only mode. Not suitable for cross-platform tests.
 2) SYSTEM="$1"; RELEASE="$2";;
 *) echo usage: $0 [system release] 1>&2; exit 1;;
esac

# No ${x%%y} support in Solaris 11 /bin/sh
RELEASE_MAJOR=`echo "$RELEASE" | sed 's/[^0-9].*//'` || exit 1

case "$SYSTEM.$RELEASE" in
   SCO_SV.3.2) SYSTYPE=SCO5
  # Use the native compiler by default
  : ${CC="/usr/bin/cc -b elf"}
  CCARGS="$CCARGS -DPIPES_CANT_FIONREAD $CCARGS"
  SYSLIBS="-lsocket -ldbm"
  RANLIB=echo
  ;;
  UnixWare.5*) SYSTYPE=UW7
  # Use the native compiler by default
  : ${CC=/usr/bin/cc}
  RANLIB=echo
  SYSLIBS="-lresolv -lsocket -lnsl"
  ;;
  UNIX_SV.4.2*) case "`uname -v`" in
       2.1*) SYSTYPE=UW21
      # Use the native compiler by default
      : ${CC=/usr/bin/cc}
      RANLIB=echo
      SYSLIBS="-lresolv -lsocket -lnsl -lc -L/usr/ucblib -lucb"
      ;;
       *) error "Seems to be UnixWare`uname -v`. Untested.";;
  esac
  ;;
  FreeBSD.2*) SYSTYPE=FREEBSD2
  ;;
  FreeBSD.3*) SYSTYPE=FREEBSD3
  ;;
  FreeBSD.4*) SYSTYPE=FREEBSD4
  ;;
  FreeBSD.5*) SYSTYPE=FREEBSD5
  ;;
  FreeBSD.6*) SYSTYPE=FREEBSD6
  ;;
  FreeBSD.7*) SYSTYPE=FREEBSD7
  ;;
  FreeBSD.8*) SYSTYPE=FREEBSD8
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
  FreeBSD.9*) SYSTYPE=FREEBSD9
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
  FreeBSD.10*) SYSTYPE=FREEBSD10
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
   FreeBSD.11*) SYSTYPE=FREEBSD11
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
   FreeBSD.12*) SYSTYPE=FREEBSD12
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
   FreeBSD.13*) SYSTYPE=FREEBSD13
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
   FreeBSD.14*) SYSTYPE=FREEBSD14
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
 DragonFly.*) SYSTYPE=DRAGONFLY
  ;;
  OpenBSD.2*) SYSTYPE=OPENBSD2
  ;;
  OpenBSD.3*) SYSTYPE=OPENBSD3
  ;;
  OpenBSD.4*) SYSTYPE=OPENBSD4
  ;;
  OpenBSD.5*) SYSTYPE=OPENBSD5
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so.1.0}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
  OpenBSD.6*) SYSTYPE=OPENBSD6
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so.1.0}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
  OpenBSD.7*) SYSTYPE=OPENBSD7
  : ${CC=cc}
  : ${SHLIB_SUFFIX=.so.1.0}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC} -shared"}
  ;;
  ekkoBSD.1*) SYSTYPE=EKKOBSD1
  ;;
   NetBSD.1*) SYSTYPE=NETBSD1
  ;;
   NetBSD.2*) SYSTYPE=NETBSD2
  ;;
   NetBSD.3*) SYSTYPE=NETBSD3
  ;;
   NetBSD.4*) SYSTYPE=NETBSD4
  ;;
   NetBSD.5*) SYSTYPE=NETBSD5
  ;;
   NetBSD.6*) SYSTYPE=NETBSD6
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
   NetBSD.7*) SYSTYPE=NETBSD7
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
   NetBSD.8*) SYSTYPE=NETBSD8
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
   NetBSD.9*) SYSTYPE=NETBSD9
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
   NetBSD.10*) SYSTYPE=NETBSD10
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
   BSD/OS.2*) SYSTYPE=BSDI2
  ;;
   BSD/OS.3*) SYSTYPE=BSDI3
  ;;
   BSD/OS.4*) SYSTYPE=BSDI4
  ;;
 OSF1.V[3-5].*) SYSTYPE=OSF1
  # Use the native compiler by default
  : ${CC=cc}
  : ${DEBUG="-g3"}
  case $RELEASE in
  V[0-4].*) CCARGS="$CCARGS -DNO_IPV6";;
  esac
  ;;
    SunOS.4*) SYSTYPE=SUNOS4
  SYSLIBS=-lresolv
  ;;
    SunOS.5*) SYSTYPE=SUNOS5
  RANLIB=echo
  SYSLIBS="-lresolv -lsocket -lnsl -ldl"
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-h,${LIB}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${SHLIB_RPATH='-Wl,-R,${SHLIB_DIR}'}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  # Stock awk breaks with >10 files.
  test -x /usr/xpg4/bin/awk && AWK=/usr/xpg4/bin/awk
  # Solaris 2.5 added usleep(), POSIX regexp, POSIX getpwnam/uid_r
  case $RELEASE in
      5.[0-4]) CCARGS="$CCARGS -DMISSING_USLEEP -DNO_POSIX_REGEXP -DNO_POSIX_GETPW_R";;
  esac
  # Solaris 2.6 added snprintf()
  case $RELEASE in
      5.[0-5]) CCARGS="$CCARGS -DNO_SNPRINTF";;
  esac
  # Solaris 8 added IPv6 and /dev/poll
  case $RELEASE in
      5.[0-7]|5.[0-7].*) CCARGS="$CCARGS -DNO_IPV6 -DNO_DEVPOLL";;
  esac
  # Solaris 9 added closefrom(), futimesat() and /dev/*random
  # and appears to have solid UNIX-domain sockets.
  case $RELEASE in
      5.[0-8]|5.[0-8].*) CCARGS="$CCARGS -DNO_CLOSEFROM -DNO_DEV_URANDOM -DNO_FUTIMESAT -DSTREAM_CONNECTIONS";;
  esac
  # Solaris 10 added setenv(), unsetenv().
  case $RELEASE in
      5.[0-9]|5.[0-9].*) CCARGS="$CCARGS -DMISSING_SETENV";;
  esac
  # NISPLUS was removed after Solaris 10.
  case $RELEASE in
      5.[0-9][0-9]*) CCARGS="$CCARGS -DNO_NISPLUS";;
  esac
  # Work around broken str*casecmp(). Do it all here instead
  # of having half the solution in the sys_defs.h file.
  CCARGS="$CCARGS -Dstrcasecmp=fix_strcasecmp \
      -Dstrncasecmp=fix_strncasecmp"
  STRCASE="strcasecmp.o"
  case "${CC}" in
  *" "*) ;;
  *ucb*) error "Don't use /usr/ucb/cc or ucblib";;
    cc*) case `which ${CC}` in
  *ucb*) error "Don't use /usr/ucb/cc or ucblib";;
    esac;;
  esac
  ;;
   ULTRIX.4*) SYSTYPE=ULTRIX4
  if [ -f /usr/local/lib/libdb.a ]; then
      SYSLIBS="$SYSLIBS -ldb"
      CCARGS="$CCARGS -DHAS_DB"
      if [ -d /usr/local/include/db ]; then
   CCARGS="$CCARGS -I/usr/local/include/db"
      fi
  fi
  for l in syslog resolv; do
      if [ -f /usr/local/lib/lib$l.a ]; then
   SYSLIBS="$SYSLIBS -l$l"
      fi
  done
  ;;
       AIX.*) case "`uname -v`" in
  6) SYSTYPE=AIX6
   CCARGS="$CCARGS -DNO_DNSSEC"
   case "$CC" in
   cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
   esac
   CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
   ;;
  5) SYSTYPE=AIX5
   CCARGS="$CCARGS -DNO_DNSSEC"
   case "$CC" in
   cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
   esac
   CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
   ;;
  4) SYSTYPE=AIX4
   CCARGS="$CCARGS -DNO_DNSSEC"
   # How embarrassing...
   case "$CC" in
   cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
   esac
   CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
   ;;
  3) SYSTYPE=AIX3
   CCARGS="$CCARGS -DNO_DNSSEC"
   # How embarrassing...
   case "$CC" in
   cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w";;
   esac
   CCARGS="$CCARGS -D_ALL_SOURCE"
   ;;
  *) error "Unknown AIX version: `uname -v`.";;
  esac;;
  # Tested with RedHat 3.03 on 20020729.
    Linux.1*) SYSTYPE=LINUX1
  case "$CCARGS" in
   *-DNO_DB*) ;;
   *-DHAS_DB*) ;;
   *) SYSLIBS="-ldb";;
  esac
  ;;
    Linux.2*) SYSTYPE=LINUX2
  case "$CCARGS" in
   *-DNO_DB*) ;;
   *-DHAS_DB*) ;;
   *) if [ -f /usr/include/db.h ]
      then
   : we are all set
      elif [ -f /usr/include/db/db.h ]
      then
   CCARGS="$CCARGS -I/usr/include/db"
      else
   # No, we're not going to try db1 db2 db3 etc.
   # On a properly installed system, Postfix builds
   # by including <db.h> and by linking with -ldb
   echo "No <db.h> include file found." 1>&2
   echo "Install the appropriate db*-devel package first." 1>&2
   echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
   exit 1
      fi
      SYSLIBS="-ldb"
      ;;
  esac
  for name in nsl resolv $GDBM_LIBS
  do
      for lib in /usr/lib64 /lib64 /usr/lib /lib
      do
   test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
       SYSLIBS="$SYSLIBS -l$name"
       break
   }
      done
  done
  # Kernel 2.4 added IPv6
  case "$RELEASE" in
  2.[0-3].*) CCARGS="$CCARGS -DNO_IPV6";;
  esac
  # Kernel 2.6 added EPOLL
  case "$RELEASE" in
  2.[0-5].*) CCARGS="$CCARGS -DNO_EPOLL";;
      # Workaround for retarded libc 
      2.6.*)
         if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
         then
      :
         elif [ ! -e /usr/include/sys/epoll.h ]
         then
      echo CCARGS="$CCARGS -DNO_EPOLL"
         else
      trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
      cat >makedefs.test.c <<'EOF'
#include <sys/types.h>
#include <sys/epoll.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int     main(int argc, char **argv)
{
    int     epoll_handle;

    if ((epoll_handle = epoll_create(1)) < 0) {
 perror("epoll_create");
 exit(1);
    }
    exit(0);
}
EOF
      ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
      ./makedefs.test 2>/dev/null ||
    CCARGS="$CCARGS -DNO_EPOLL"
      rm -f makedefs.test makedefs.test.[co]
         fi;;
  esac
  SYSLIBS="$SYSLIBS -ldl"
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,--enable-new-dtags -Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
    Linux.[34567].*)
  SYSTYPE=LINUX$RELEASE_MAJOR
  case "$CCARGS" in
   *-DNO_DB*) ;;
   *-DHAS_DB*) ;;
   *) if [ -f /usr/include/db.h ]
      then
   : we are all set
      elif [ -f /usr/include/db/db.h ]
      then
   CCARGS="$CCARGS -I/usr/include/db"
      else
   # On a properly installed system, Postfix builds
   # by including <db.h> and by linking with -ldb
   echo "No <db.h> include file found." 1>&2
   echo "Install the appropriate db*-devel package first." 1>&2
   echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
   echo "See: https://www.postfix.org/NON_BERKELEYDB_README.html#build-conf1>&le='color: green'>2
   exit 1
      fi
      SYSLIBS="-ldb"
      ;;
  esac
  for name in nsl resolv
  do
      for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
      do
   test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
       SYSLIBS="$SYSLIBS -l$name"
       break
   }
      done
  done
  SYSLIBS="$SYSLIBS -ldl"
  : ${SHLIB_SUFFIX=.so}
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
  : ${SHLIB_RPATH='-Wl,--enable-new-dtags -Wl,-rpath,${SHLIB_DIR}'}
  : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
  : ${PLUGIN_LD="${CC-gcc} -shared"}
  ;;
     GNU.0*|GNU/kFreeBSD.[567]*)
  SYSTYPE=GNU0
  case "$CCARGS" in
   *-DNO_DB*) ;;
   *) if [ -f /usr/include/db.h ]
      then
   : we are all set
      elif [ -f /usr/include/db/db.h ]
      then
   CCARGS="$CCARGS -I/usr/include/db"
      else
   # On a properly installed system, Postfix builds
   # by including <db.h> and by linking with -ldb
   echo "No <db.h> include file found." 1>&2
   echo "Install the appropriate db*-devel package first." 1>&2
   echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
   exit 1
      fi
      SYSLIBS="-ldb"
      ;;
  esac
  for name in nsl resolv
  do
      for lib in /usr/lib64 /lib64 /usr/lib /lib
      do
   test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
       SYSLIBS="$SYSLIBS -l$name"
       break
   }
      done
  done
  case "`uname -s`" in
  GNU)
   # currently no IPv6 support on Hurd
   CCARGS="$CCARGS -DNO_IPV6"
   ;;
  esac
  ;;
     IRIX*.5.*) SYSTYPE=IRIX5
  # Use the native compiler by default
  : ${CC=cc} ${DEBUG="-g3"}
  RANLIB=echo
  ;;
     IRIX*.6.*) SYSTYPE=IRIX6
  # Use the native compiler by default, and allow nested comments.
  : ${CC="cc -woff 1009,1116,1412"}
  RANLIB=echo
  ;;
HP-UX.A.09.*) SYSTYPE=HPUX9
  SYSLIBS=-ldbm
  CCARGS="$CCARGS -DMISSING_USLEEP -DNO_SNPRINTF"
  if [ -f /usr/lib/libdb.a ]; then
      CCARGS="$CCARGS -DHAS_DB"
      SYSLIBS="$SYSLIBS -ldb"
  fi
  ;;
HP-UX.B.10.*) SYSTYPE=HPUX10
  CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null |
      (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`"
  CCARGS="$CCARGS -DNO_SNPRINTF"
  if [ -f /usr/lib/libdb.a ]; then
      CCARGS="$CCARGS -DHAS_DB"
      SYSLIBS=-ldb
  fi
  ;;
HP-UX.B.11.*) SYSTYPE=HPUX11
  SYSLIBS=-lnsl
  if [ -f /usr/lib/libdb.a ]; then
      CCARGS="$CCARGS -DHAS_DB"
      SYSLIBS="$SYSLIBS -ldb"
  fi
  ;;
ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
  RANLIB=echo
  SYSLIBS="-lresolv -lsocket -lnsl"
  ;;
    Darwin.*)   SYSTYPE=MACOSX
  # Use the native compiler by default
  : ${CC=cc}
  CCARGS="$CCARGS"
  # Darwin > 1.3 uses awk and flat_namespace
  case $RELEASE in
   1.[0-3]) AWK=gawk;;
         *) AWK=awk
     SYSLIBS="$SYSLIBS -flat_namespace";;
  esac
  # Darwin 7 adds IPv6 support, BIND_8_COMPAT, NO_NETINFO
  case $RELEASE in
   [1-6].*) CCARGS="$CCARGS -DNO_IPV6";;
         *) CCARGS="$CCARGS -DBIND_8_COMPAT -DNO_NETINFO";;
  esac
  # Darwin 9.0 (MacOS X 10.5) adds POSIX getpwnam_r/getpwuid_r
  case $RELEASE in
   [1-8].*) CCARGS="$CCARGS -DNO_POSIX_GETPW_R";;
  esac
  # Darwin 10.3.0 no longer has <nameser8_compat.h>.
  case $RELEASE in
       ?.*) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_NAMESER8_COMPAT_H";;
         *) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_ARPA_NAMESER_COMPAT_H";;
  esac
  # Darwin 11.x (MacOS X 10.7.x), maybe earlier, needs libresolv.
  case $RELEASE in
  ?.*|10.*) ;;
         *) SYSLIBS="$SYSLIBS -lresolv";;
  esac
  # Darwin 21 linker without additional coaxing complains about
  # -Wl,-undefined,dynamic_lookup
  case $RELEASE in
  2[1-9].*|[3-9]?.*) NOFIXUP="-Wl,-no_fixup_chains ";;
    *) NOFIXUP="";;
  esac
  # kqueue and/or poll are broken in MacOS X 10.5 (Darwin 9).
  # kqueue works in Mac OS X 10.8 (Darwin 12).
  case $RELEASE in
     ?.*|1[0-1].*) CCARGS="$CCARGS -DNO_KQUEUE";;
  esac
  : ${SHLIB_CFLAGS=-fPIC}
  : ${SHLIB_SUFFIX=.dylib}
  : ${SHLIB_LD="cc -shared -Wl,-flat_namespace ${NOFIXUP}-Wl,-undefined,dynamic_lookup "'-Wl,-install_name,@rpath/${LIB}'}
  : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
                # In MacOS/X 10.11.x /bin/sh unsets DYLD_LIBRARY_PATH, so we
                # have export it into postfix-install indirectly!
  : ${SHLIB_ENV="DYLD_LIBRARY_PATH=`pwd`/lib SHLIB_ENV_VAR=DYLD_LIBRARY_PATH SHLIB_ENV_VAL=`pwd`/lib"}
  : ${PLUGIN_LD="cc -shared -Wl,-flat_namespace ${NOFIXUP}-Wl,-undefined,dynamic_lookup"}
  ;;
    dcosx.1*) SYSTYPE=DCOSX1
  RANLIB=echo
  SYSLIBS="-lresolv -lsocket -lnsl -lc -lrpcsvc -L/usr/ucblib -lucb"
  ;;

  ".") if [ -d /NextApps ]; then
      SYSTYPE=`hostinfo | sed -n \
   's/^.*NeXT Mach 3.*$/NEXTSTEP3/;/NEXTSTEP3/{p;q;}'`
      if [ "$SYSTYPE" = "" ]; then
   SYSTYPE=`hostinfo | sed -n \
       's/^.*NeXT Mach 4.*$/OPENSTEP4/;/OPENSTEP4/{p;q;}'`
      fi
      : ${CC=cc}
      RANLIB="sleep 5; ranlib"
  else
      error "Unable to determine your system type."
  fi
  ;;
    *) error "Unknown system type: $SYSTEM $RELEASE";;
esac

#
# sigsetjmp()/siglongjmp() can be "better" than setjmp()/longjmp()
# if used wisely (that is: almost never, just like signals).
# Unfortunately some implementations have been buggy in the past.
#
case "$CCARGS" in
 *-DNO_SIGSETJMP*) ;;
  *) trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
     cat >makedefs.test.c <<'EOF'
#include <setjmp.h>
#include <stdlib.h>
#include <stdio.h>

static int count = 0;

int     main(int argc, char **argv)
{
    sigjmp_buf env;
    int     retval;

    switch (retval = sigsetjmp(env, 1)) {
    case 0:
 siglongjmp(env, 12345);
    case 12345:
 break;
    default:
 fprintf(stderr, "Error: siglongjmp ignores second argument\n");
 exit(1);
    }

    switch (retval = sigsetjmp(env, 1)) {
    case 0:
 if (count++ > 0) {
     fprintf(stderr, "Error: not overriding siglongjmp(env, 0)\n");
     exit(1);
 }
 siglongjmp(env, 0);
    case 1:
 break;
    default:
 fprintf(stderr, "Error: overriding siglongjmp(env, 0) with %d\n",
  retval);
 exit(1);
    }
    exit(0);
}
EOF
     ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
     ./makedefs.test 2>/dev/null ||
   CCARGS="$CCARGS -DNO_SIGSETJMP"
     rm -f makedefs.test makedefs.test.[co]
esac

#
# Look for the ICU library and enable unicode email if available.
#
case "$CCARGS" in
*-DNO_EAI*) CCARGS="$CCARGS "'-DDEF_SMTPUTF8_ENABLE=\"no\"';;
  *) icu_cppflags=`((pkg-config --cflags icu-uc icu-i18n) ||
    (pkgconf --cflags icu-uc icu-i18n) ||
    (icu-config --cppflags)) 2>/dev/null` && {
  icu_ldflags=`((pkg-config --libs icu-uc icu-i18n) ||
    (pkgconf --libs icu-uc icu-i18n) ||
    (icu-config --ldflags)) 2>/dev/null` && {
      trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
      cat >makedefs.test.c <<'EOF'
#include <unicode/uidna.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    char    buf[1024];
    UErrorCode error = U_ZERO_ERROR;
    UIDNAInfo info = UIDNA_INFO_INITIALIZER;
    UIDNA  *idna = uidna_openUTS46(UIDNA_DEFAULT, &error);

    exit(uidna_labelToUnicodeUTF8(idna,
      "xn--lgbbat1ad8j", /* an arabic TLD */
      15,
      buf,
      sizeof(buf),
      &info,
      &error) != 14);
}
EOF
      ${CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
   $icu_ldflags >/dev/null 2>&1
      if ./makedefs.test 2>/dev/null ; then
   CCARGS="$CCARGS $icu_cppflags"
   SYSLIBS="$SYSLIBS $icu_ldflags"
      else
   CCARGS="$CCARGS -DNO_EAI"
      fi
      rm -f makedefs.test makedefs.test.[co]
  }
     } || CCARGS="$CCARGS -DNO_EAI"' -DDEF_SMTPUTF8_ENABLE=\"no\"'
esac

#
# OpenSSL has no configuration query utility, but we don't try to
# guess. We assume includes in /usr/include/openssl and libraries in
# /usr/lib, or in their /usr/local equivalents. If the OpenSSL files
# are in a non-standard place, their locations need to be specified.
#
#case "$CCARGS" in
# *-DUSE_TLS*) ;;
#  *-DNO_TLS*) ;;
#           *) CCARGS="$CCARGS -DUSE_TLS"
#  AUXLIBS="$AUXLIBS -lssl -lcrypto"
#  ;;
#esac

#
# We don't know all systems that have /dev/urandom, so we probe.
#
test -r /dev/urandom && CCARGS="$CCARGS -DHAS_DEV_URANDOM"

#
# PCRE 3.x has a pcre-config utility so we don't have to guess.
#
case "$CCARGS" in
*-DHAS_PCRE*) ;;
 *-DNO_PCRE*) ;;
    *) if pcre_cflags=`(pcre2-config --cflags) 2>/dev/null` &&
      pcre_libs=`(pcre2-config --libs8) 2>/dev/null` 
  then
      CCARGS="$CCARGS -DHAS_PCRE=2 $pcre_cflags"
      AUXLIBS_PCRE="$pcre_libs"
  elif pcre_cflags=`(pcre-config --cflags) 2>/dev/null` &&
      pcre_libs=`(pcre-config --libs) 2>/dev/null` 
  then
      CCARGS="$CCARGS -DHAS_PCRE=1 $pcre_cflags"
      AUXLIBS_PCRE="$pcre_libs"
  fi
  ;;
esac

# C23 introduces a new built-in type 'bool' which breaks past Postfix
# practice. Other compilers provide emulation. Don't try to guess where
# the compiler hides <stbool.h>.
case "$CCARGS" in
 *-DNO_STDBOOL*) ;;
 *) cat >makedefs.test.c <<'EOF'
#include <stdbool.h>
bool x;
EOF
    ${CC-gcc} -c makedefs.test.c >/dev/null 2>&1 ||
 CCARGS="$CCARGS -DNO_STDBOOL"
    rm -f makedefs.test.[co]
    ;;
esac

# Defaults that can be overruled (make makefiles CC=cc OPT=-O6 DEBUG=)
# Disable optimizations by default when compiling for Purify. Disable
# optimizations by default with gcc 2.8, until the compiler is known to
# be OK. Those who dare can still overrule this (make makefiles OPT=-O).

case "$CC" in
 *purify*) : ${OPT=};;
*/gcc|gcc) case `$CC -v` in
    "gcc version 2.8"*) : ${OPT=};;
    esac;;
      *CC) error "Don't use CC. That's the C++ compiler";;
 *) : ${OPT='-O'};;
esac

# Snapshot only.
#CCARGS="$CCARGS -DSNAPSHOT"

# Non-production: needs thorough testing, or major changes are still
# needed before the code stabilizes.
#CCARGS="$CCARGS -DNONPROD"

# Workaround: prepend Postfix include files before other include files.
CCARGS="-I. -I../../include $CCARGS"

# Portability and usability considerations.
#
# In an ideal world we would be able to provide the option to say
# "make makefiles shlib_directory=/some/where/'$mail_version'".  This
# would allow a running system to be upggraded without worries about
# tempororary program-library ABI incompatibilities (the Postfix
# library API changes incompatibly from one version to the next).
#
# Unfortunately, gmake performs macro expansion on values in name=value
# command-line arguments. In the specific example above, gmake would
# eat up the "$" and "m" before it even invokes makedefs, and it
# ould replace "'${mail_version}'" and "'$(mail_version)'" with
# nothing.
#
# Requiring people to specify $$ is not a good option. Instead we
# replace the string MAIL_VERSION at the end of parameter values in
# "make makefiles name=value...". The replacement depends on usage
# context: the expanded release version in actual pathnames, or the
# unexpanded ${mail_version} in configuration parameter values (both
# main.cf and built-in defaults).

# Helper function to determine DEF_MAIL_VERSION.

def_mail_version()
{
    trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
    cat > makedefs.test.c <<'EOF'
#include <stdlib.h>
#include <stdio.h>
EOF
        # Avoid "nested comment" warnings. Top-of-file comments start in
        # column 1 and have no code after "*/", not even in header files.
        # If this is insufficient, kill the problem with #ifndef MAKEDEFS.
        sed '/^\/\*/,/\*\//d' src/global/mail_version.h >>makedefs.test.c
        cat >>makedefs.test.c <<EOF
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int     main(void)
{
    printf("%s\n", DEF_MAIL_VERSION);
    fflush(stdout);
    exit(ferror(stdout) ? 1 : 0);
}
EOF
    eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
    ./makedefs.test || exit 1
    rm -f makedefs.test makedefs.test.[co]
}

# Helper to expand MAIL_VERSION at the end of a command-line parameter value.

# Note that MAIL_VERSION) does not anchor the match at the end.

process_input_parameter()
{
    echo "#" $parm_name=$parm_val
    case "$parm_val" in
    *MAIL_VERSION*)
 cparm_val=`echo "$parm_val" | \
     sed 's/MAIL_VERSION$/\\\\$${mail_version}/g'`|| exit 1
 case "$mail_version" in
 "") mail_version=`def_mail_version` || exit 1
 esac
 parm_val=`echo "$parm_val" | sed 's/MAIL_VERSION$/'"$mail_version/g"` ||
     exit 1
 case "$parm_val" in
 *MAIL_VERSION*)
     error "MAIL_VERSION not at end of parameter value: $parm_val"
 esac
 eval ${parm_name}=\""\$parm_val"\";;
     *) cparm_val="$parm_val";;
    esac
    CCARGS="$CCARGS -D$parm_macro=\\\"$cparm_val\\\""
}

# Optionally override installation-parameter default settings.

command_directory_macro=DEF_COMMAND_DIR
config_directory_macro=DEF_CONFIG_DIR
daemon_directory_macro=DEF_DAEMON_DIR
data_directory_macro=DEF_DATA_DIR
mail_spool_directory_macro=DEF_MAIL_SPOOL_DIR
mailq_path_macro=DEF_MAILQ_PATH
meta_directory_macro=DEF_META_DIR
newaliases_path_macro=DEF_NEWALIAS_PATH
queue_directory_macro=DEF_QUEUE_DIR
sendmail_path_macro=DEF_SENDMAIL_PATH
shlib_directory_macro=DEF_SHLIB_DIR
openssl_path_macro=DEF_OPENSSL_PATH

# shlib_directory is checked here because "no" is not a good answer.
# Instead, build with "dynamicmaps=no" and "shared=no" as appropriate.

for parm_name in command_directory config_directory daemon_directory \
 data_directory mail_spool_directory mailq_path meta_directory \
 newaliases_path queue_directory sendmail_path shlib_directory \
 openssl_path
do
    eval parm_val=\"\$$parm_name\"
    eval parm_macro=\"\$${parm_name}_macro\"
    case "$parm_val" in
    "") ;;
    /*) process_input_parameter;;
     *) error "$parm_name must specify an absolute path name";;
    esac
done

html_directory_macro=DEF_HTML_DIR
manpage_directory_macro=DEF_MANPAGE_DIR
readme_directory_macro=DEF_README_DIR

for parm_name in html_directory manpage_directory readme_directory
do
    eval parm_val=\"\$$parm_name\"
    eval parm_macro=\"\$${parm_name}_macro\"
    case "$parm_val" in
    "") ;;
 /*|no) process_input_parameter;;
     *) error "$parm_name must specify \"no\" or an absolute path name";;
    esac
done

default_cache_db_type_macro=DEF_CACHE_DB_TYPE
default_database_type_macro=DEF_DB_TYPE

for parm_name in default_cache_db_type default_database_type
do
    eval parm_val=\"\$$parm_name\"
    eval parm_macro=\"\$${parm_name}_macro\"
    case "$parm_val" in
    "") ;;
     *) process_input_parameter;;
    esac
done

echo "# End of summary of user-configurable 'make makefiles' options."
echo "#--------------------------------------------------------------"

# The following are for non-shared libsasl and libmilter builds.

_AR=$AR
_RANLIB=$RANLIB

# Choose between dynamic and static library builds.

case "$dynamicmaps" in
  yes) shared=yes;;
""|no) ;;
    *) error "Specify \"dynamicmaps=yes\" or \"dynamicmaps=no\"";;
esac

case "$shared" in
yes)
    if [ -z "$SHLIB_SUFFIX" ]
    then 
 error "Shared libraries are requested, but not supported on this platform"
    fi
    AR=:
    RANLIB=:
    CCARGS="$CCARGS -DUSE_DYNAMIC_LIBS"
    case "$dynamicmaps" in
    yes) NON_PLUGIN_MAP_OBJ=
  PLUGIN_MAP_OBJ='$(MAP_OBJ)'
  PLUGIN_MAP_OBJ_UPDATE=plugin_map_obj_update
  PLUGIN_MAP_SO_MAKE=plugin_map_so_make
  PLUGIN_MAP_SO_UPDATE=plugin_map_so_update
  CCARGS="$CCARGS -DUSE_DYNAMIC_MAPS"
  ;;
      *) NON_PLUGIN_MAP_OBJ='$(MAP_OBJ)'
  PLUGIN_MAP_OBJ=
  PLUGIN_MAP_OBJ_UPDATE=
  PLUGIN_MAP_SO_MAKE=
  PLUGIN_MAP_SO_UPDATE=
  PLUGIN_LD=
  CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS"
  ;;
    esac

    # Determine the dynamically-linked library and plugin installation
    # directory.

    parm_name=shlib_directory
    eval parm_val=\"\$$parm_name\"
    eval parm_macro=\"\$${parm_name}_macro\"
    case "$parm_val" in
    /*|no) # CCARGS was already updated above.
 ;;
    "") trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
 sed -n '
     /_SHLIB_DIR/,/^$/p
 ' src/global/mail_params.h >makedefs.test.c
 cat >>makedefs.test.c <<EOF
#include <stdlib.h>
#include <stdio.h>
int     main(void)
{
    printf("%s\n", $parm_macro);
    fflush(stdout);
    exit(ferror(stdout) ? 1 : 0);
}
EOF
 eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
 parm_val=`./makedefs.test` || exit 1
 rm -f makedefs.test makedefs.test.[co]
 eval ${parm_name}=\""\$parm_val"\"
 #CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\""
 ;;
     *) # this parameter was already checked above.
 error "Can't happen in $0 - $parm_val is not an absolute path"
 ;;
    esac

    LIB_PREFIX=postfix-
    LIB_SUFFIX=${SHLIB_SUFFIX}
    ;;

no|"")
    shlib_directory=no
    CCARGS="$CCARGS -UUSE_DYNAMIC_LIBS -DDEF_SHLIB_DIR=\\\"no\\\""
    CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS"
    SHLIB_CFLAGS=
    SHLIB_SUFFIX=
    SHLIB_LD=:
    SHLIB_SYSLIBS=
    SHLIB_RPATH=
    SHLIB_ENV=
    LIB_PREFIX=
    LIB_SUFFIX=.a
    NON_PLUGIN_MAP_OBJ='$(MAP_OBJ)'
    PLUGIN_MAP_OBJ=
    PLUGIN_MAP_OBJ_UPDATE=
    PLUGIN_MAP_SO_MAKE=
    PLUGIN_MAP_SO_UPDATE=
    PLUGIN_LD=
    ;;

*)  error "Specify \"shared=yes\" or \"shared=no\""
    ;;
esac

# "gcc -W" 3.4.2 no longer reports functions that fail to return a
# result.  Use "gcc -Wall -Wno-comment" instead. We'll figure out
# later if the other -Wmumble options are really redundant. Having
# een burned once by a compiler that lies about what warnings it
# produces, not taking that chance again.

: ${CC=gcc} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \
${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
 -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
 -Wunused -Wno-missing-braces -fno-common'}

# Extract map type names from -DHAS_XXX compiler options.  We avoid
# problems with tr(1) range syntax by using enumerations instead,
# and we don't try to figure out which awk versions have tolower().
# The following was validated in 2014 on FreeBSD/Linux and Solaris 9.

DEFINED_MAP_TYPES=`
    echo $CCARGS | sed 's/=[^ ]*//g' | 
 tr -cd '\- _ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | 
 tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | ${AWK} '
 { for (n = 1; n <= NF; n++)
       if ($n ~ /^-dhas_/)
    if (seen[name = substr($n, 7)]++ == 0)
        printf(" %s", name) }
'`

# Propagate AUXLIBS_FOO or merge them into global AUXLIBS (i.e. SYSLIBS).

PLUGGABLE_MAPS="CDB LDAP LMDB MONGODB MYSQL PCRE PGSQL SDBM SQLITE"

case "$dynamicmaps" in
yes) for name in $PLUGGABLE_MAPS
     do
  eval test -n "\"\$AUXLIBS_$name\"" && 
      eval PLUGIN_AUXLIBS="\"\$PLUGIN_AUXLIBS
AUXLIBS_$name = \$AUXLIBS_$name\""
     done;;
  *) for name in $PLUGGABLE_MAPS
     do
  eval AUXLIBS="\"\$AUXLIBS \$AUXLIBS_$name\""
     done;;
esac

# Remove static libraries from SYSLIBS when building shared objects,
# Can't use the shell "case" patterns to detect names ending in *.a.

case "$shared" in
yes) SHLIB_SYSLIBS=`${AWK} '
     BEGIN { wc = split("'"$AUXLIBS $SYSLIBS"'", words) 
  for (n = 1; n <= wc; n++)
      if (words[n] !~ /\.a$/)
   printf(" %s", words[n])
     }
     '`
esac

# Choose between PIE and non-PIE builds.

case "$pie" in
  yes) case "$shared" in
        yes) CCARGS_PIE="-fPIC";;
          *) CCARGS_PIE="-fPIE";;
       esac
       case " $CCARGS " in
         *" $CCARGS_PIE "*) CCARGS_PIE=;;
       esac
       SYSLIBS_PIE="-pie";;
""|no) ;;
    *) error "Specify \"pie=yes\" or \"pie=no\"";;
esac

# Don't permit random overrides.
allowed_user_install_opts="-keep-build-mtime"
for opt in $POSTFIX_INSTALL_OPTS
do
    (for allowed in -keep-build-mtime
    do
 test "$opt" = "$allowed" && exit 0
    done; exit 1) || error "invalid option '$opt' in POSTFIX_INSTALL_OPTS"
done

# If -DNO_DB is specified then 'hash' and 'btree' will be unavailable.

check_no_db_overrides()
{
    trap 'rm -f makedefs.test makedefs.test.[co]' 0 1 2 3 15
        cat src/util/sys_defs.h >makedefs.test.c
        cat >>makedefs.test.c <<'EOF'
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int     main(void)
{
    struct def_info {
 const char *mac_name;
 const char *parm_name;
 const char *def_type;
 const char *problem;
    };
    struct def_info def_infos[] = {
 {"DEF_DB_TYPE", "default_database_type", DEF_DB_TYPE},
 {"DEF_CACHE_DB_TYPE", "default_cache_db_type", DEF_CACHE_DB_TYPE},
    };
    const char *bdb_types[] = {"hash", "btree"};
    struct def_info *pdef_info;
    const char *const * pbdb_type;
    const char *three_bs = "\\\\\\";
    int     status = 0;

    for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
 for (pbdb_type = bdb_types; pbdb_type < bdb_types + 2; pbdb_type++) {
     if (strcmp(pdef_info->def_type, *pbdb_type) == 0) {
  pdef_info->problem = *pbdb_type;
  status = 1;
     }
 }
    }
    if (status != 0) {
 fprintf(stderr, "\nBuilding with -DNO_DB, but at least one default "
  "setting still\nrequires 'hash' or 'btree':\n");
 for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
     if (pdef_info->problem) {
  fprintf(stderr, "  %s=%s\n", pdef_info->parm_name,
   pdef_info->problem);
     }
 }
 fprintf(stderr, "\nTo fix, specify types other than 'hash' or 'btree', "
   "for example:\n  make makefiles ... \\\n    ");
 for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
     if (pdef_info->problem) {
  fprintf(stderr, " %s=lmdb", pdef_info->parm_name);
     }
 }
 fprintf(stderr, " ...\n\nOr, using older syntax:\n");
 fprintf(stderr, "  make makefiles ... \\\n    CCARGS=\"$CCARGS -DNO_DB");
 for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
     if (pdef_info->problem) {
  fprintf(stderr, " -D%s=%s\"lmdb%s\"",
   pdef_info->mac_name, three_bs, three_bs);
     }
 }
 fprintf(stderr, " ...\" ...\n\n");
    }
    exit(status);
}
EOF
    eval ${CC-gcc} ${CCARGS} -D$SYSTYPE -o makedefs.test makedefs.test.c || exit 1
    ./makedefs.test || exit 1
    rm -f makedefs.test makedefs.test.[co]
}

case "$CCARGS" in
 *-DNO_DB*) check_no_db_overrides || exit 1;;
esac

# Finally...

sed 's/   */ /g' <<EOF
# System-dependent settings and compiler/linker overrides.
SYSTYPE = $SYSTYPE
_AR = $_AR
ARFL = $ARFL
_RANLIB = $_RANLIB
SYSLIBS = $SYSLIBS_PIE $AUXLIBS $SYSLIBS $PLUGIN_AUXLIBS
CC = $CC $CCARGS_PIE $CCARGS \$(WARN)
OPT = $OPT
DEBUG = $DEBUG
AWK = $AWK
STRCASE = $STRCASE
EXPORT = CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
WARN = $WARN
DEFINED_MAP_TYPES = $DEFINED_MAP_TYPES
MAKE_FIX = $MAKE_FIX
# Switch between Postfix static and dynamically-linked libraries.
AR = $AR
RANLIB = $RANLIB
LIB_PREFIX = $LIB_PREFIX
LIB_SUFFIX = $LIB_SUFFIX
SHLIB_CFLAGS = $SHLIB_CFLAGS
SHLIB_DIR = $shlib_directory
SHLIB_ENV = $SHLIB_ENV
SHLIB_LD = $SHLIB_LD
SHLIB_SYSLIBS = $SHLIB_SYSLIBS
SHLIB_RPATH = $SHLIB_RPATH
# Switch between dynamicmaps.cf plugins and hard-linked databases.
NON_PLUGIN_MAP_OBJ = $NON_PLUGIN_MAP_OBJ
PLUGIN_MAP_OBJ = $PLUGIN_MAP_OBJ
PLUGIN_MAP_OBJ_UPDATE = $PLUGIN_MAP_OBJ_UPDATE
PLUGIN_MAP_SO_MAKE = $PLUGIN_MAP_SO_MAKE
PLUGIN_MAP_SO_UPDATE = $PLUGIN_MAP_SO_UPDATE
PLUGIN_LD = $PLUGIN_LD
POSTFIX_INSTALL_OPTS = $POSTFIX_INSTALL_OPTS
# Application-specific rules.
EOF

[Dauer der Verarbeitung: 0.27 Sekunden, vorverarbeitet 2026-08-06]