Home | History | Annotate | Line # | Download | only in dist
      1 #!/bin/sh
      2 
      3 # To view the formatted manual page of this file, type:
      4 #       POSTFIXSOURCE/mantools/srctoman - makedefs | nroff -man
      5 
      6 #++
      7 # NAME
      8 #	makedefs 1
      9 # SUMMARY
     10 #	Postfix makefile configuration utility
     11 # SYNOPSIS
     12 #	\fBmake makefiles \fIname=value...\fR
     13 # DESCRIPTION
     14 #	The \fBmakedefs\fR command identifies the compilation
     15 #	environment, and emits macro definitions on the standard
     16 #	output stream that can be prepended to template Makefiles.
     17 #	These macros implement an internal interface and are subject
     18 #	to change without notice.
     19 # NAME=VALUE OVERRIDES
     20 # .ad
     21 # .fi
     22 #	Default settings can be overruled by specifying them as
     23 #	environment variables (or as name=value pairs on the "make"
     24 #	command line). Use quotes if variables contain whitespace
     25 #	or shell meta characters.
     26 #
     27 #	The command "\fBmake makefiles name=value...\fR" will replace
     28 #	the string \fBMAIL_VERSION\fR at the end of a value with the
     29 #	Postfix version (\fImajor.minor.patchlevel\fR for a stable
     30 #	release, \fImajor.minor-date\fR for a development release).
     31 #	Do not try to specify something like \fB$mail_version\fR:
     32 #	that produces inconsistent results with different implementations
     33 #	of the make(1) command.
     34 # .IP \fBAUXLIBS=\fIobject_library...\fR
     35 #	Specifies one or more non-default object libraries. Postfix
     36 #	3.0 and later specify some of their database library
     37 #	dependencies with AUXLIBS_CDB, AUXLIBS_LDAP, AUXLIBS_LMDB,
     38 #	AUXLIBS_MONGODB,
     39 #	AUXLIBS_MYSQL, AUXLIBS_PCRE, AUXLIBS_PGSQL, AUXLIBS_SDBM,
     40 #	and AUXLIBS_SQLITE, respectively.
     41 # .IP \fBCC=\fIcompiler_command\fR
     42 #	Specifies a non-default compiler. On many systems, the default
     43 #	is \fBgcc\fR.
     44 # .IP \fBCCARGS=\fIcompiler_arguments\fR
     45 #	Specifies non-default compiler arguments, for example, a non-default
     46 #	\fIinclude\fR directory.
     47 #	The following directives are special:
     48 # .RS
     49 # .IP \fB-DNO_CLOSEFROM\fR
     50 #	Do not use the system closefom() implementation.
     51 # .IP \fB-DNO_DB\fR
     52 #	Do not build with Berkeley DB support.
     53 # .IP \fB-DNO_DEVPOLL\fR
     54 #	Do not build with Solaris /dev/poll support.
     55 #	By default, /dev/poll support is compiled in on platforms that
     56 #	are known to support it.
     57 # .IP \fB-DNO_DNSSEC\fR
     58 #	Do not build with DNSSEC support, even if the resolver
     59 #	library appears to support it.
     60 # .IP \fB-DNO_EPOLL\fR
     61 #	Do not build with Linux EPOLL support.
     62 #	By default, EPOLL support is compiled in on platforms that
     63 #	are known to support it.
     64 # .IP \fB-DNO_EAI\fR
     65 #	Do not build with EAI (SMTPUTF8) support. By default, EAI
     66 #	support is compiled in when the "pkgconf" or "pkg-config"
     67 #	command are
     68 #	found, or the deprecated "icu-config" command.
     69 # .IP \fB-DNO_INLINE\fR
     70 #	Do not require support for C99 "inline" functions. Instead,
     71 #	implement argument typechecks for non-(printf/scanf)-like
     72 #	functions with ternary operators and unreachable code.
     73 # .IP \fB-DNO_IPV6\fR
     74 #	Do not build with IPv6 support.
     75 #	By default, IPv6 support is compiled in on platforms that
     76 #	are known to have IPv6 support.
     77 #
     78 #	Note: this directive is for debugging and testing only. It
     79 #	is not guaranteed to work on all platforms. If you don't
     80 #	want IPv6 support, set "inet_protocols = ipv4" in main.cf.
     81 # .IP \fB-DNO_IP_CYRUS_SASL_AUTH\fR
     82 #	Don't pass remote SMTP client and Postfix SMTP server IP
     83 #	address and port information to the Cyrus SASL library.
     84 #	This is compatible with Postfix < 3.2.
     85 # .IP \fB-DNO_KQUEUE\fR
     86 #	Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE support.
     87 #	By default, KQUEUE support is compiled in on platforms that
     88 #	are known to support it.
     89 # .IP \fB-DNO_NIS\fR
     90 #	Do not build with NIS or NISPLUS support. Support for NIS
     91 #	is unavailable on some recent Linux distributions.
     92 # .IP \fB-DNO_NISPLUS\fR
     93 #	Do not build with NISPLUS support. Support for NISPLUS
     94 #	is unavailable on some recent Solaris distributions.
     95 # .IP \fB-DNO_PCRE\fR
     96 #	Do not build with PCRE support.
     97 #	By default, PCRE support is compiled in when the \fBpcre2-config\fR
     98 #	or \fBpcre-config\fR utility are installed.
     99 # .IP \fB-DNO_POSIX_GETPW_R\fR
    100 #	Disable support for POSIX getpwnam_r/getpwuid_r.
    101 # .IP \fB-DNO_RES_NCALLS\fR
    102 #	Do not build with the threadsafe resolver(5) API (res_ninit() etc.).
    103 # .IP \fB-DNO_SIGSETJMP\fR
    104 #	Use setjmp()/longjmp() instead of sigsetjmp()/siglongjmp().
    105 #	By default, Postfix uses sigsetjmp()/siglongjmp() when they
    106 #	appear to work.
    107 # .IP \fB-DNO_SNPRINTF\fR
    108 #	Use sprintf() instead of snprintf(). By default, Postfix
    109 #	uses snprintf() except on ancient systems.
    110 # .IP \fB-DNO_STDBOOL\fR
    111 #	Don't use <stdbool.h>. This is usually auto-detected.
    112 # .RE
    113 # .IP \fBDEBUG=\fIdebug_level\fR
    114 #	Specifies a non-default debugging level. The default is \fB-g\fR.
    115 #	Specify \fBDEBUG=\fR to turn off debugging.
    116 # .IP \fBOPT=\fIoptimization_level\fR
    117 #	Specifies a non-default optimization level. The default is \fB-O\fR.
    118 #	Specify \fBOPT=\fR to turn off optimization.
    119 # .IP \fBPOSTFIX_INSTALL_OPTS=\fI-option...\fR
    120 #	Specifies options for the postfix-install command, separated
    121 #	by whitespace. Currently, the only supported option is
    122 #	\fB-keep-build-mtime\fR.
    123 # .IP \fBSHLIB_CFLAGS=\fIflags\fR
    124 #	Override the compiler flags (typically, "-fPIC") for Postfix
    125 #	dynamically-linked libraries and database plugins.
    126 #
    127 #	This feature was introduced with Postfix 3.0.
    128 # .IP \fBSHLIB_RPATH=\fIrpath\fR
    129 #	Override the runpath (typically, "'-Wl,-rpath,${SHLIB_DIR}'")
    130 #	for Postfix dynamically-linked libraries.
    131 #
    132 #	This feature was introduced with Postfix 3.0.
    133 # .IP \fBSHLIB_SUFFIX=\fIsuffix\fR
    134 #	Override the filename suffix (typically, ".so") for Postfix
    135 #	dynamically-linked libraries and database plugins.
    136 #
    137 #	This feature was introduced with Postfix 3.0.
    138 # .IP \fBshared=yes\fR
    139 # .IP \fBshared=no\fR
    140 #	Enable (disable) Postfix builds with dynamically-linked
    141 #	libraries typically named $shlib_directory/libpostfix-*.so.*.
    142 #
    143 #	This feature was introduced with Postfix 3.0.
    144 # .IP \fBdynamicmaps=yes\fR
    145 # .IP \fBdynamicmaps=no\fR
    146 #	Enable (disable) Postfix builds with the configuration file
    147 #	$meta_directory/dynamicmaps.cf and dynamically-loadable
    148 #	database plugins typically named postfix-*.so.*.  The setting
    149 #	"dynamicmaps=yes" implicitly enables Postfix dynamically-linked
    150 #	libraries.
    151 #
    152 #	This feature was introduced with Postfix 3.0.
    153 # .IP \fBpie=yes\fR
    154 # .IP \fBpie=no\fR
    155 #	Enable (disable) Postfix builds with position-independent
    156 #	executables, on platforms where this is supported.
    157 #
    158 #	This feature was introduced with Postfix 3.0.
    159 # .IP \fIinstallation_parameter\fB=\fIvalue\fR...
    160 #	Override the compiled-in default value of the specified
    161 #	installation parameter(s). The following parameters are
    162 #	supported in this context:
    163 #
    164 #	command_directory config_directory daemon_directory
    165 #	data_directory default_cache_db_type default_database_type
    166 #	html_directory mail_spool_directory mailq_path manpage_directory
    167 #	meta_directory newaliases_path queue_directory readme_directory
    168 #	sendmail_path shlib_directory openssl_path
    169 #
    170 #	See the postconf(5) manpage for a description of these
    171 #	parameters.
    172 #
    173 #	This feature was introduced with Postfix 3.0.
    174 # .IP \fBWARN=\fIwarning_flags\fR
    175 #	Specifies non-default gcc compiler warning options for use when
    176 #	"make" is invoked in a source subdirectory only.
    177 # LICENSE
    178 # .ad
    179 # .fi
    180 #	The Secure Mailer license must be distributed with this software.
    181 # AUTHOR(S)
    182 #	Wietse Venema
    183 #	IBM T.J. Watson Research
    184 #	P.O. Box 704
    185 #	Yorktown Heights, NY 10598, USA
    186 #
    187 #	Wietse Venema
    188 #	Google, Inc.
    189 #	111 8th Avenue
    190 #	New York, NY 10011, USA
    191 #--
    192 
    193 # Override all LC_* settings and LANG for reproducibility.
    194 LC_ALL=C; export LC_ALL
    195 
    196 # By now all shells must have functions.
    197 
    198 error() {
    199    # Alas, tput(1) is not portable so we can't use visual effects.
    200    echo "ATTENTION:" 1>&2;
    201    echo "ATTENTION:" $* 1>&2;
    202    echo "ATTENTION:" 1>&2;
    203    exit 1
    204 }
    205 
    206 # First, deal with unsupported usage.
    207 case "$LD_LIBRARY_PATH" in
    208 ?*) error "Not supported: building with LD_LIBRARY_PATH";;
    209 esac
    210 
    211 env | grep '^AUXLIBS_' | while read line
    212 do
    213     case  "$line" in
    214 *-lpostfix-*) error "Not supported: linking plugins with -lpostfix-*: $line";;
    215     esac
    216 done || exit 1
    217 
    218 # Suggest a fix for systems without grep -E or -F flags.
    219 (echo foo | grep -E foo 2>/dev/null | grep -F foo >/dev/null 2>/dev/null) || 
    220     error "No grep -[EF] support. See auxiliary/fix-grep for a conversion tool."
    221 
    222 # Emit system-dependent Makefile macro definitions to standard output.
    223 
    224 echo "#----------------------------------------------------------------"
    225 echo "# Start of summary of user-configurable 'make makefiles' options."
    226 echo "# CCARGS=$CCARGS"
    227 echo "# AUXLIBS=$AUXLIBS"
    228 env | grep '^AUXLIBS_' | sed 's/^/# /' | sort
    229 echo "# shared=$shared"
    230 echo "# dynamicmaps=$dynamicmaps"
    231 echo "# pie=$pie"
    232 
    233 # Defaults for most sane systems
    234 
    235 RANLIB=ranlib
    236 SYSLIBS=
    237 AR=ar
    238 ARFL=rv
    239 
    240 # Ugly function to make our error message more visible among the
    241 # garbage that is output by some versions of make(1).
    242 
    243 case $# in
    244  # Officially supported usage.
    245  0) SYSTEM=`(uname -s) 2>/dev/null`
    246     RELEASE=`(uname -r) 2>/dev/null`
    247     VERSION=`(uname -v) 2>/dev/null`
    248     case "$VERSION" in
    249      dcosx*) SYSTEM=$VERSION;;
    250     esac;;
    251  # Unsupported debug-only mode. Not suitable for cross-platform tests.
    252  2) SYSTEM="$1"; RELEASE="$2";;
    253  *) echo usage: $0 [system release] 1>&2; exit 1;;
    254 esac
    255 
    256 # No ${x%%y} support in Solaris 11 /bin/sh
    257 RELEASE_MAJOR=`echo "$RELEASE" | sed 's/[^0-9].*//'` || exit 1
    258 
    259 case "$SYSTEM.$RELEASE" in
    260    SCO_SV.3.2)	SYSTYPE=SCO5
    261 		# Use the native compiler by default
    262 		: ${CC="/usr/bin/cc -b elf"}
    263 		CCARGS="$CCARGS -DPIPES_CANT_FIONREAD $CCARGS"
    264 		SYSLIBS="-lsocket -ldbm"
    265 		RANLIB=echo
    266 		;;
    267   UnixWare.5*)	SYSTYPE=UW7
    268 		# Use the native compiler by default
    269 		: ${CC=/usr/bin/cc}
    270 		RANLIB=echo
    271 		SYSLIBS="-lresolv -lsocket -lnsl"
    272 		;;
    273   UNIX_SV.4.2*)	case "`uname -v`" in
    274 	      2.1*) SYSTYPE=UW21
    275 		    # Use the native compiler by default
    276 		    : ${CC=/usr/bin/cc}
    277 		    RANLIB=echo
    278 		    SYSLIBS="-lresolv -lsocket -lnsl -lc -L/usr/ucblib -lucb"
    279 		    ;;
    280 	      *) error "Seems to be UnixWare`uname -v`. Untested.";;
    281 		esac
    282 		;;
    283   FreeBSD.2*)	SYSTYPE=FREEBSD2
    284 		;;
    285   FreeBSD.3*)	SYSTYPE=FREEBSD3
    286 		;;
    287   FreeBSD.4*)	SYSTYPE=FREEBSD4
    288 		;;
    289   FreeBSD.5*)	SYSTYPE=FREEBSD5
    290 		;;
    291   FreeBSD.6*)	SYSTYPE=FREEBSD6
    292 		;;
    293   FreeBSD.7*)	SYSTYPE=FREEBSD7
    294 		;;
    295   FreeBSD.8*)	SYSTYPE=FREEBSD8
    296 		: ${SHLIB_SUFFIX=.so}
    297 		: ${SHLIB_CFLAGS=-fPIC}
    298 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    299 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    300 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    301 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    302 		;;
    303   FreeBSD.9*)	SYSTYPE=FREEBSD9
    304 		: ${SHLIB_SUFFIX=.so}
    305 		: ${SHLIB_CFLAGS=-fPIC}
    306 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    307 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    308 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    309 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    310 		;;
    311   FreeBSD.10*)	SYSTYPE=FREEBSD10
    312 		: ${CC=cc}
    313 		: ${SHLIB_SUFFIX=.so}
    314 		: ${SHLIB_CFLAGS=-fPIC}
    315 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    316 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    317 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    318 		: ${PLUGIN_LD="${CC} -shared"}
    319 		;;
    320    FreeBSD.11*) SYSTYPE=FREEBSD11
    321 		: ${CC=cc}
    322 		: ${SHLIB_SUFFIX=.so}
    323 		: ${SHLIB_CFLAGS=-fPIC}
    324 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    325 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    326 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    327 		: ${PLUGIN_LD="${CC} -shared"}
    328 		;;
    329    FreeBSD.12*) SYSTYPE=FREEBSD12
    330 		: ${CC=cc}
    331 		: ${SHLIB_SUFFIX=.so}
    332 		: ${SHLIB_CFLAGS=-fPIC}
    333 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    334 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    335 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    336 		: ${PLUGIN_LD="${CC} -shared"}
    337 		;;
    338    FreeBSD.13*)	SYSTYPE=FREEBSD13
    339 		: ${CC=cc}
    340 		: ${SHLIB_SUFFIX=.so}
    341 		: ${SHLIB_CFLAGS=-fPIC}
    342 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    343 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    344 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    345 		: ${PLUGIN_LD="${CC} -shared"}
    346 		;;
    347    FreeBSD.14*)	SYSTYPE=FREEBSD14
    348 		: ${CC=cc}
    349 		: ${SHLIB_SUFFIX=.so}
    350 		: ${SHLIB_CFLAGS=-fPIC}
    351 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    352 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    353 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    354 		: ${PLUGIN_LD="${CC} -shared"}
    355 		;;
    356    FreeBSD.15*)	SYSTYPE=FREEBSD15
    357 		: ${CC=cc}
    358 		: ${SHLIB_SUFFIX=.so}
    359 		: ${SHLIB_CFLAGS=-fPIC}
    360 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    361 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    362 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    363 		: ${PLUGIN_LD="${CC} -shared"}
    364 		;;
    365    FreeBSD.16*)	SYSTYPE=FREEBSD16
    366 		: ${CC=cc}
    367 		: ${SHLIB_SUFFIX=.so}
    368 		: ${SHLIB_CFLAGS=-fPIC}
    369 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    370 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    371 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    372 		: ${PLUGIN_LD="${CC} -shared"}
    373 		;;
    374  DragonFly.*)	SYSTYPE=DRAGONFLY
    375 		;;
    376   OpenBSD.2*)	SYSTYPE=OPENBSD2
    377 		;;
    378   OpenBSD.3*)	SYSTYPE=OPENBSD3
    379 		;;
    380   OpenBSD.4*)	SYSTYPE=OPENBSD4
    381 		;;
    382   OpenBSD.5*)	SYSTYPE=OPENBSD5
    383 		: ${CC=cc}
    384 		: ${SHLIB_SUFFIX=.so.1.0}
    385 		: ${SHLIB_CFLAGS=-fPIC}
    386 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    387 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    388 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    389 		: ${PLUGIN_LD="${CC} -shared"}
    390 		;;
    391   OpenBSD.6*)	SYSTYPE=OPENBSD6
    392 		: ${CC=cc}
    393 		: ${SHLIB_SUFFIX=.so.1.0}
    394 		: ${SHLIB_CFLAGS=-fPIC}
    395 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    396 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    397 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    398 		: ${PLUGIN_LD="${CC} -shared"}
    399 		;;
    400   OpenBSD.7*)	SYSTYPE=OPENBSD7
    401 		: ${CC=cc}
    402 		: ${SHLIB_SUFFIX=.so.1.0}
    403 		: ${SHLIB_CFLAGS=-fPIC}
    404 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    405 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    406 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    407 		: ${PLUGIN_LD="${CC} -shared"}
    408 		;;
    409   OpenBSD.8*)	SYSTYPE=OPENBSD8
    410 		: ${CC=cc}
    411 		: ${SHLIB_SUFFIX=.so.1.0}
    412 		: ${SHLIB_CFLAGS=-fPIC}
    413 		: ${SHLIB_LD="${CC} -shared"' -Wl,-soname,${LIB}'}
    414 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    415 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    416 		: ${PLUGIN_LD="${CC} -shared"}
    417 		;;
    418   ekkoBSD.1*)	SYSTYPE=EKKOBSD1
    419 		;;
    420    NetBSD.1.*)	SYSTYPE=NETBSD1
    421 		;;
    422    NetBSD.2*)	SYSTYPE=NETBSD2
    423 		;;
    424    NetBSD.3*)	SYSTYPE=NETBSD3
    425 		;;
    426    NetBSD.4*)	SYSTYPE=NETBSD4
    427 		;;
    428    NetBSD.5*)	SYSTYPE=NETBSD5
    429 		;;
    430    NetBSD.6*)	SYSTYPE=NETBSD6
    431 		: ${SHLIB_SUFFIX=.so}
    432 		: ${SHLIB_CFLAGS=-fPIC}
    433 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    434 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    435 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    436 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    437 		;;
    438    NetBSD.7*)	SYSTYPE=NETBSD7
    439 		: ${SHLIB_SUFFIX=.so}
    440 		: ${SHLIB_CFLAGS=-fPIC}
    441 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    442 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    443 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    444 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    445 		;;
    446    NetBSD.8*)	SYSTYPE=NETBSD8
    447 		: ${SHLIB_SUFFIX=.so}
    448 		: ${SHLIB_CFLAGS=-fPIC}
    449 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    450 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    451 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    452 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    453 		;;
    454    NetBSD.9*)	SYSTYPE=NETBSD9
    455 		: ${SHLIB_SUFFIX=.so}
    456 		: ${SHLIB_CFLAGS=-fPIC}
    457 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    458 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    459 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    460 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    461 		;;
    462    NetBSD.10*)	SYSTYPE=NETBSD10
    463 		: ${SHLIB_SUFFIX=.so}
    464 		: ${SHLIB_CFLAGS=-fPIC}
    465 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    466 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    467 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    468 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    469 		;;
    470    NetBSD.11*)	SYSTYPE=NETBSD11
    471 		: ${SHLIB_SUFFIX=.so}
    472 		: ${SHLIB_CFLAGS=-fPIC}
    473 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    474 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    475 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    476 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    477 		;;
    478    NetBSD.12*)	SYSTYPE=NETBSD12
    479 		: ${SHLIB_SUFFIX=.so}
    480 		: ${SHLIB_CFLAGS=-fPIC}
    481 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    482 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    483 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    484 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    485 		;;
    486    BSD/OS.2*)	SYSTYPE=BSDI2
    487 		;;
    488    BSD/OS.3*)	SYSTYPE=BSDI3
    489 		;;
    490    BSD/OS.4*)	SYSTYPE=BSDI4
    491 		;;
    492  OSF1.V[3-5].*)	SYSTYPE=OSF1
    493 		# Use the native compiler by default
    494 		: ${CC=cc}
    495 		: ${DEBUG="-g3"}
    496 		case $RELEASE in
    497 		V[0-4].*) CCARGS="$CCARGS -DNO_IPV6";;
    498 		esac
    499 		;;
    500     SunOS.4*)	SYSTYPE=SUNOS4
    501 		SYSLIBS=-lresolv
    502 		;;
    503     SunOS.5*)	SYSTYPE=SUNOS5
    504 		RANLIB=echo
    505 		SYSLIBS="-lresolv -lsocket -lnsl -ldl"
    506 		: ${SHLIB_SUFFIX=.so}
    507 		: ${SHLIB_CFLAGS=-fPIC}
    508 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-h,${LIB}'}
    509 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    510 		: ${SHLIB_RPATH='-Wl,-R,${SHLIB_DIR}'}
    511 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    512 		# Stock awk breaks with >10 files.
    513 		test -x /usr/xpg4/bin/awk && AWK=/usr/xpg4/bin/awk
    514 		# Solaris 2.5 added usleep(), POSIX regexp, POSIX getpwnam/uid_r
    515 		case $RELEASE in
    516 		    5.[0-4]) CCARGS="$CCARGS -DMISSING_USLEEP -DNO_POSIX_REGEXP -DNO_POSIX_GETPW_R";;
    517 		esac
    518 		# Solaris 2.6 added snprintf()
    519 		case $RELEASE in
    520 		    5.[0-5]) CCARGS="$CCARGS -DNO_SNPRINTF";;
    521 		esac
    522 		# Solaris 8 added IPv6 and /dev/poll
    523 		case $RELEASE in
    524 		    5.[0-7]|5.[0-7].*) CCARGS="$CCARGS -DNO_IPV6 -DNO_DEVPOLL";;
    525 		esac
    526 		# Solaris 9 added closefrom(), futimesat() and /dev/*random
    527 		# and appears to have solid UNIX-domain sockets.
    528 		case $RELEASE in
    529 		    5.[0-8]|5.[0-8].*) CCARGS="$CCARGS -DNO_CLOSEFROM -DNO_DEV_URANDOM -DNO_FUTIMESAT -DSTREAM_CONNECTIONS";;
    530 		esac
    531 		# Solaris 10 added setenv(), unsetenv().
    532 		case $RELEASE in
    533 		    5.[0-9]|5.[0-9].*) CCARGS="$CCARGS -DMISSING_SETENV";;
    534 		esac
    535 		# NISPLUS was removed after Solaris 10.
    536 		case $RELEASE in
    537 		    5.[0-9][0-9]*) CCARGS="$CCARGS -DNO_NISPLUS";;
    538 		esac
    539 		# Work around broken str*casecmp(). Do it all here instead
    540 		# of having half the solution in the sys_defs.h file.
    541 		CCARGS="$CCARGS -Dstrcasecmp=fix_strcasecmp \
    542 		    -Dstrncasecmp=fix_strncasecmp"
    543 		STRCASE="strcasecmp.o"
    544 		case "${CC}" in
    545 		*" "*) ;;
    546 		*ucb*) error "Don't use /usr/ucb/cc or ucblib";;
    547 		  cc*) case `which ${CC}` in
    548 		*ucb*) error "Don't use /usr/ucb/cc or ucblib";;
    549 		  esac;;
    550 		esac
    551 		;;
    552    ULTRIX.4*)	SYSTYPE=ULTRIX4
    553 		if [ -f /usr/local/lib/libdb.a ]; then
    554 		    SYSLIBS="$SYSLIBS -ldb"
    555 		    CCARGS="$CCARGS -DHAS_DB"
    556 		    if [ -d /usr/local/include/db ]; then
    557 			CCARGS="$CCARGS -I/usr/local/include/db"
    558 		    fi
    559 		fi
    560 		for l in syslog resolv; do
    561 		    if [ -f /usr/local/lib/lib$l.a ]; then
    562 			SYSLIBS="$SYSLIBS -l$l"
    563 		    fi
    564 		done
    565 		;;
    566        AIX.*)	case "`uname -v`" in
    567 		6)	SYSTYPE=AIX6
    568 			CCARGS="$CCARGS -DNO_DNSSEC"
    569 			case "$CC" in
    570 			cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
    571 			esac
    572 			CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
    573 			;;
    574 		5)	SYSTYPE=AIX5
    575 			CCARGS="$CCARGS -DNO_DNSSEC"
    576 			case "$CC" in
    577 			cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
    578 			esac
    579 			CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
    580 			;;
    581 		4)	SYSTYPE=AIX4
    582 			CCARGS="$CCARGS -DNO_DNSSEC"
    583 			# How embarrassing...
    584 			case "$CC" in
    585 			cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
    586 			esac
    587 			CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
    588 			;;
    589 		3)	SYSTYPE=AIX3
    590 			CCARGS="$CCARGS -DNO_DNSSEC"
    591 			# How embarrassing...
    592 			case "$CC" in
    593 			cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w";;
    594 			esac
    595 			CCARGS="$CCARGS -D_ALL_SOURCE"
    596 			;;
    597 		*)	error "Unknown AIX version: `uname -v`.";;
    598 		esac;;
    599 		# Tested with RedHat 3.03 on 20020729.
    600     Linux.1*)	SYSTYPE=LINUX1
    601 		case "$CCARGS" in
    602 		 *-DNO_DB*) ;;
    603 		 *-DHAS_DB*) ;;
    604 		 *) SYSLIBS="-ldb";;
    605 		esac
    606 		;;
    607     Linux.2*)	SYSTYPE=LINUX2
    608 		case "$CCARGS" in
    609 		 *-DNO_DB*) ;;
    610 		 *-DHAS_DB*) ;;
    611 		 *) if [ -f /usr/include/db.h ]
    612 		    then
    613 			: we are all set
    614 		    elif [ -f /usr/include/db/db.h ]
    615 		    then
    616 			CCARGS="$CCARGS -I/usr/include/db"
    617 		    else
    618 			# No, we're not going to try db1 db2 db3 etc.
    619 			# On a properly installed system, Postfix builds
    620 			# by including <db.h> and by linking with -ldb
    621 			echo "No <db.h> include file found." 1>&2
    622 			echo "Install the appropriate db*-devel package first." 1>&2
    623 			echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
    624 			exit 1
    625 		    fi
    626 		    SYSLIBS="-ldb"
    627 		    ;;
    628 		esac
    629 		for name in nsl resolv $GDBM_LIBS
    630 		do
    631 		    for lib in /usr/lib64 /lib64 /usr/lib /lib
    632 		    do
    633 			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
    634 			    SYSLIBS="$SYSLIBS -l$name"
    635 			    break
    636 			}
    637 		    done
    638 		done
    639 		# Kernel 2.4 added IPv6
    640 		case "$RELEASE" in
    641 		2.[0-3].*) CCARGS="$CCARGS -DNO_IPV6";;
    642 		esac
    643 		# Kernel 2.6 added EPOLL
    644 		case "$RELEASE" in
    645 		2.[0-5].*) CCARGS="$CCARGS -DNO_EPOLL";;
    646 		    # Workaround for retarded libc 
    647 		    2.6.*)
    648 		       if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
    649 		       then
    650 			   :
    651 		       elif [ ! -e /usr/include/sys/epoll.h ]
    652 		       then
    653 			   echo CCARGS="$CCARGS -DNO_EPOLL"
    654 		       else
    655 			   trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
    656 			   cat >makedefs.test.c <<'EOF'
    657 #include <sys/types.h>
    658 #include <sys/epoll.h>
    659 #include <errno.h>
    660 #include <stdio.h>
    661 #include <stdlib.h>
    662 
    663 int     main(int argc, char **argv)
    664 {
    665     int     epoll_handle;
    666 
    667     if ((epoll_handle = epoll_create(1)) < 0) {
    668 	perror("epoll_create");
    669 	exit(1);
    670     }
    671     exit(0);
    672 }
    673 EOF
    674 			   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
    675 			   ./makedefs.test 2>/dev/null ||
    676 				CCARGS="$CCARGS -DNO_EPOLL"
    677 			   rm -f makedefs.test makedefs.test.[co]
    678 		       fi;;
    679 		esac
    680 		SYSLIBS="$SYSLIBS -ldl"
    681 		: ${SHLIB_SUFFIX=.so}
    682 		: ${SHLIB_CFLAGS=-fPIC}
    683 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    684 		: ${SHLIB_RPATH='-Wl,--enable-new-dtags -Wl,-rpath,${SHLIB_DIR}'}
    685 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    686 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    687 		;;
    688     Linux.[34567].*)
    689 		SYSTYPE=LINUX$RELEASE_MAJOR
    690 		case "$CCARGS" in
    691 		 *-DNO_DB*) ;;
    692 		 *-DHAS_DB*) ;;
    693 		 *) if [ -f /usr/include/db.h ]
    694 		    then
    695 			: we are all set
    696 		    elif [ -f /usr/include/db/db.h ]
    697 		    then
    698 			CCARGS="$CCARGS -I/usr/include/db"
    699 		    else
    700 			# On a properly installed system, Postfix builds
    701 			# by including <db.h> and by linking with -ldb
    702 			echo "No <db.h> include file found." 1>&2
    703 			echo "Install the appropriate db*-devel package first." 1>&2
    704 			echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
    705 			echo "See: https://www.postfix.org/NON_BERKELEYDB_README.html#build-conf" 1>&2
    706 			exit 1
    707 		    fi
    708 		    SYSLIBS="-ldb"
    709 		    ;;
    710 		esac
    711 		for name in nsl resolv
    712 		do
    713 		    for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
    714 		    do
    715 			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
    716 			    SYSLIBS="$SYSLIBS -l$name"
    717 			    break
    718 			}
    719 		    done
    720 		done
    721 		SYSLIBS="$SYSLIBS -ldl"
    722 		: ${SHLIB_SUFFIX=.so}
    723 		: ${SHLIB_CFLAGS=-fPIC}
    724 		: ${SHLIB_LD="${CC-gcc} -shared"' -Wl,-soname,${LIB}'}
    725 		: ${SHLIB_RPATH='-Wl,--enable-new-dtags -Wl,-rpath,${SHLIB_DIR}'}
    726 		: ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
    727 		: ${PLUGIN_LD="${CC-gcc} -shared"}
    728 		;;
    729      GNU.0*|GNU/kFreeBSD.[567]*)
    730 		SYSTYPE=GNU0
    731 		case "$CCARGS" in
    732 		 *-DNO_DB*) ;;
    733 		 *) if [ -f /usr/include/db.h ]
    734 		    then
    735 			: we are all set
    736 		    elif [ -f /usr/include/db/db.h ]
    737 		    then
    738 			CCARGS="$CCARGS -I/usr/include/db"
    739 		    else
    740 			# On a properly installed system, Postfix builds
    741 			# by including <db.h> and by linking with -ldb
    742 			echo "No <db.h> include file found." 1>&2
    743 			echo "Install the appropriate db*-devel package first." 1>&2
    744 			echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
    745 			exit 1
    746 		    fi
    747 		    SYSLIBS="-ldb"
    748 		    ;;
    749 		esac
    750 		for name in nsl resolv
    751 		do
    752 		    for lib in /usr/lib64 /lib64 /usr/lib /lib
    753 		    do
    754 			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
    755 			    SYSLIBS="$SYSLIBS -l$name"
    756 			    break
    757 			}
    758 		    done
    759 		done
    760 		case "`uname -s`" in
    761 		GNU)
    762 			# currently no IPv6 support on Hurd
    763 			CCARGS="$CCARGS -DNO_IPV6"
    764 			;;
    765 		esac
    766 		;;
    767      IRIX*.5.*)	SYSTYPE=IRIX5
    768 		# Use the native compiler by default
    769 		: ${CC=cc} ${DEBUG="-g3"}
    770 		RANLIB=echo
    771 		;;
    772      IRIX*.6.*)	SYSTYPE=IRIX6
    773 		# Use the native compiler by default, and allow nested comments.
    774 		: ${CC="cc -woff 1009,1116,1412"}
    775 		RANLIB=echo
    776 		;;
    777 HP-UX.A.09.*)	SYSTYPE=HPUX9
    778 		SYSLIBS=-ldbm
    779 		CCARGS="$CCARGS -DMISSING_USLEEP -DNO_SNPRINTF"
    780 		if [ -f /usr/lib/libdb.a ]; then
    781 		    CCARGS="$CCARGS -DHAS_DB"
    782 		    SYSLIBS="$SYSLIBS -ldb"
    783 		fi
    784 		;;
    785 HP-UX.B.10.*)	SYSTYPE=HPUX10
    786 		CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null |
    787 		    (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`"
    788 		CCARGS="$CCARGS -DNO_SNPRINTF"
    789 		if [ -f /usr/lib/libdb.a ]; then
    790 		    CCARGS="$CCARGS -DHAS_DB"
    791 		    SYSLIBS=-ldb
    792 		fi
    793 		;;
    794 HP-UX.B.11.*)	SYSTYPE=HPUX11
    795 		SYSLIBS=-lnsl
    796 		if [ -f /usr/lib/libdb.a ]; then
    797 		    CCARGS="$CCARGS -DHAS_DB"
    798 		    SYSLIBS="$SYSLIBS -ldb"
    799 		fi
    800 		;;
    801 ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
    802 		RANLIB=echo
    803 		SYSLIBS="-lresolv -lsocket -lnsl"
    804 		;;
    805     Darwin.*)   SYSTYPE=MACOSX
    806 		# Use the native compiler by default
    807 		: ${CC=cc}
    808 		CCARGS="$CCARGS"
    809 		# Darwin > 1.3 uses awk and flat_namespace
    810 		case $RELEASE in
    811 		 1.[0-3]) AWK=gawk;;
    812 		       *) AWK=awk
    813 			  SYSLIBS="$SYSLIBS -flat_namespace";;
    814 		esac
    815 		# Darwin 7 adds IPv6 support, BIND_8_COMPAT, NO_NETINFO
    816 		case $RELEASE in
    817 		 [1-6].*) CCARGS="$CCARGS -DNO_IPV6";;
    818 		       *) CCARGS="$CCARGS -DBIND_8_COMPAT -DNO_NETINFO";;
    819 		esac
    820 		# Darwin 9.0 (MacOS X 10.5) adds POSIX getpwnam_r/getpwuid_r
    821 		case $RELEASE in
    822 		 [1-8].*) CCARGS="$CCARGS -DNO_POSIX_GETPW_R";;
    823 		esac
    824 		# Darwin 10.3.0 no longer has <nameser8_compat.h>.
    825 		case $RELEASE in
    826 		     ?.*) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_NAMESER8_COMPAT_H";;
    827 		       *) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_ARPA_NAMESER_COMPAT_H";;
    828 		esac
    829 		# Darwin 11.x (MacOS X 10.7.x), maybe earlier, needs libresolv.
    830 		case $RELEASE in
    831 		?.*|10.*) ;;
    832 		       *) SYSLIBS="$SYSLIBS -lresolv";;
    833 		esac
    834 		# Darwin 21 linker without additional coaxing complains about
    835 		# -Wl,-undefined,dynamic_lookup
    836 		case $RELEASE in
    837 		2[1-9].*|[3-9]?.*) NOFIXUP="-Wl,-no_fixup_chains ";;
    838 				*) NOFIXUP="";;
    839 		esac
    840 		# kqueue and/or poll are broken in MacOS X 10.5 (Darwin 9).
    841 		# kqueue works in Mac OS X 10.8 (Darwin 12).
    842 		case $RELEASE in
    843 	    ?.*|1[0-1].*) CCARGS="$CCARGS -DNO_KQUEUE";;
    844 		esac
    845 		: ${SHLIB_CFLAGS=-fPIC}
    846 		: ${SHLIB_SUFFIX=.dylib}
    847 		: ${SHLIB_LD="cc -shared -Wl,-flat_namespace ${NOFIXUP}-Wl,-undefined,dynamic_lookup "'-Wl,-install_name,@rpath/${LIB}'}
    848 		: ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
    849                 # In MacOS/X 10.11.x /bin/sh unsets DYLD_LIBRARY_PATH, so we
    850                 # have export it into postfix-install indirectly!
    851 		: ${SHLIB_ENV="DYLD_LIBRARY_PATH=`pwd`/lib SHLIB_ENV_VAR=DYLD_LIBRARY_PATH SHLIB_ENV_VAL=`pwd`/lib"}
    852 		: ${PLUGIN_LD="cc -shared -Wl,-flat_namespace ${NOFIXUP}-Wl,-undefined,dynamic_lookup"}
    853 		;;
    854     dcosx.1*)	SYSTYPE=DCOSX1
    855 		RANLIB=echo
    856 		SYSLIBS="-lresolv -lsocket -lnsl -lc -lrpcsvc -L/usr/ucblib -lucb"
    857 		;;
    858 
    859 	 ".")	if [ -d /NextApps ]; then
    860 		    SYSTYPE=`hostinfo | sed -n \
    861 			's/^.*NeXT Mach 3.*$/NEXTSTEP3/;/NEXTSTEP3/{p;q;}'`
    862 		    if [ "$SYSTYPE" = "" ]; then
    863 			SYSTYPE=`hostinfo | sed -n \
    864 			    's/^.*NeXT Mach 4.*$/OPENSTEP4/;/OPENSTEP4/{p;q;}'`
    865 		    fi
    866 		    : ${CC=cc}
    867 		    RANLIB="sleep 5; ranlib"
    868 		else
    869 		    error "Unable to determine your system type."
    870 		fi
    871 		;;
    872 	   *)	error "Unknown system type: $SYSTEM $RELEASE";;
    873 esac
    874 
    875 #
    876 # sigsetjmp()/siglongjmp() can be "better" than setjmp()/longjmp()
    877 # if used wisely (that is: almost never, just like signals).
    878 # Unfortunately some implementations have been buggy in the past.
    879 #
    880 case "$CCARGS" in
    881  *-DNO_SIGSETJMP*) ;;
    882 		*) trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
    883 		   cat >makedefs.test.c <<'EOF'
    884 #include <setjmp.h>
    885 #include <stdlib.h>
    886 #include <stdio.h>
    887 
    888 static int count = 0;
    889 
    890 int     main(int argc, char **argv)
    891 {
    892     sigjmp_buf env;
    893     int     retval;
    894 
    895     switch (retval = sigsetjmp(env, 1)) {
    896     case 0:
    897 	siglongjmp(env, 12345);
    898     case 12345:
    899 	break;
    900     default:
    901 	fprintf(stderr, "Error: siglongjmp ignores second argument\n");
    902 	exit(1);
    903     }
    904 
    905     switch (retval = sigsetjmp(env, 1)) {
    906     case 0:
    907 	if (count++ > 0) {
    908 	    fprintf(stderr, "Error: not overriding siglongjmp(env, 0)\n");
    909 	    exit(1);
    910 	}
    911 	siglongjmp(env, 0);
    912     case 1:
    913 	break;
    914     default:
    915 	fprintf(stderr, "Error: overriding siglongjmp(env, 0) with %d\n",
    916 		retval);
    917 	exit(1);
    918     }
    919     exit(0);
    920 }
    921 EOF
    922 		   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
    923 		   ./makedefs.test 2>/dev/null ||
    924 			CCARGS="$CCARGS -DNO_SIGSETJMP"
    925 		   rm -f makedefs.test makedefs.test.[co]
    926 esac
    927 
    928 #
    929 # Look for the ICU library and enable unicode email if available.
    930 #
    931 case "$CCARGS" in
    932 *-DNO_EAI*) CCARGS="$CCARGS "'-DDEF_SMTPUTF8_ENABLE=\"no\"';;
    933 	 *) icu_cppflags=`((pkg-config --cflags icu-uc icu-i18n) ||
    934 		  (pkgconf --cflags icu-uc icu-i18n) ||
    935 		  (icu-config --cppflags)) 2>/dev/null` && {
    936 		icu_ldflags=`((pkg-config --libs icu-uc icu-i18n) ||
    937 		  (pkgconf --libs icu-uc icu-i18n) ||
    938 		  (icu-config --ldflags)) 2>/dev/null` && {
    939 		    trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
    940 		    cat >makedefs.test.c <<'EOF'
    941 #include <unicode/uidna.h>
    942 #include <stdlib.h>
    943 
    944 int main(int argc, char **argv)
    945 {
    946     char    buf[1024];
    947     UErrorCode error = U_ZERO_ERROR;
    948     UIDNAInfo info = UIDNA_INFO_INITIALIZER;
    949     UIDNA  *idna = uidna_openUTS46(UIDNA_DEFAULT, &error);
    950 
    951     exit(uidna_labelToUnicodeUTF8(idna,
    952 				  "xn--lgbbat1ad8j",	/* an arabic TLD */
    953 				  15,
    954 				  buf,
    955 				  sizeof(buf),
    956 				  &info,
    957 				  &error) != 14);
    958 }
    959 EOF
    960 		    ${CC-gcc} -o makedefs.test makedefs.test.c $icu_cppflags \
    961 			$icu_ldflags >/dev/null 2>&1
    962 		    if ./makedefs.test 2>/dev/null ; then
    963 			CCARGS="$CCARGS $icu_cppflags"
    964 			SYSLIBS="$SYSLIBS $icu_ldflags"
    965 		    else
    966 			CCARGS="$CCARGS -DNO_EAI"
    967 		    fi
    968 		    rm -f makedefs.test makedefs.test.[co]
    969 		}
    970 	    } || CCARGS="$CCARGS -DNO_EAI"' -DDEF_SMTPUTF8_ENABLE=\"no\"'
    971 esac
    972 
    973 #
    974 # OpenSSL has no configuration query utility, but we don't try to
    975 # guess. We assume includes in /usr/include/openssl and libraries in
    976 # /usr/lib, or in their /usr/local equivalents. If the OpenSSL files
    977 # are in a non-standard place, their locations need to be specified.
    978 #
    979 #case "$CCARGS" in
    980 # *-DUSE_TLS*)	;;
    981 #  *-DNO_TLS*)	;;
    982 #           *)	CCARGS="$CCARGS -DUSE_TLS"
    983 #		AUXLIBS="$AUXLIBS -lssl -lcrypto"
    984 #		;;
    985 #esac
    986 
    987 #
    988 # We don't know all systems that have /dev/urandom, so we probe.
    989 #
    990 test -r /dev/urandom && CCARGS="$CCARGS -DHAS_DEV_URANDOM"
    991 
    992 #
    993 # PCRE 3.x has a pcre-config utility so we don't have to guess.
    994 #
    995 case "$CCARGS" in
    996 *-DHAS_PCRE*)	;;
    997  *-DNO_PCRE*)	;;
    998 	   *)	if pcre_cflags=`(pcre2-config --cflags) 2>/dev/null` &&
    999 		    pcre_libs=`(pcre2-config --libs8) 2>/dev/null` 
   1000 		then
   1001 		    CCARGS="$CCARGS -DHAS_PCRE=2 $pcre_cflags"
   1002 		    AUXLIBS_PCRE="$pcre_libs"
   1003 		elif pcre_cflags=`(pcre-config --cflags) 2>/dev/null` &&
   1004 		    pcre_libs=`(pcre-config --libs) 2>/dev/null` 
   1005 		then
   1006 		    CCARGS="$CCARGS -DHAS_PCRE=1 $pcre_cflags"
   1007 		    AUXLIBS_PCRE="$pcre_libs"
   1008 		fi
   1009 		;;
   1010 esac
   1011 
   1012 # C23 introduces a new built-in type 'bool' which breaks past Postfix
   1013 # practice. Other compilers provide emulation. Don't try to guess where
   1014 # the compiler hides <stbool.h>.
   1015 case "$CCARGS" in
   1016  *-DNO_STDBOOL*) ;;
   1017  *) cat >makedefs.test.c <<'EOF'
   1018 #include <stdbool.h>
   1019 bool x;
   1020 EOF
   1021     ${CC-gcc} -c makedefs.test.c >/dev/null 2>&1 ||
   1022 	CCARGS="$CCARGS -DNO_STDBOOL"
   1023     rm -f makedefs.test.[co]
   1024     ;;
   1025 esac
   1026 
   1027 # Defaults that can be overruled (make makefiles CC=cc OPT=-O6 DEBUG=)
   1028 # Disable optimizations by default when compiling for Purify. Disable
   1029 # optimizations by default with gcc 2.8, until the compiler is known to
   1030 # be OK. Those who dare can still overrule this (make makefiles OPT=-O).
   1031 
   1032 case "$CC" in
   1033  *purify*) : ${OPT=};;
   1034 */gcc|gcc) case `$CC -v` in
   1035 	   "gcc version 2.8"*) : ${OPT=};;
   1036 	   esac;;
   1037       *CC) error "Don't use CC. That's the C++ compiler";;
   1038 	*) : ${OPT='-O'};;
   1039 esac
   1040 
   1041 # Snapshot only.
   1042 #CCARGS="$CCARGS -DSNAPSHOT"
   1043 
   1044 # Non-production: needs thorough testing, or major changes are still
   1045 # needed before the code stabilizes.
   1046 #CCARGS="$CCARGS -DNONPROD"
   1047 
   1048 # Workaround: prepend Postfix include files before other include files.
   1049 CCARGS="-I. -I../../include $CCARGS"
   1050 
   1051 # Portability and usability considerations.
   1052 #
   1053 # In an ideal world we would be able to provide the option to say
   1054 # "make makefiles shlib_directory=/some/where/'$mail_version'".  This
   1055 # would allow a running system to be upggraded without worries about
   1056 # tempororary program-library ABI incompatibilities (the Postfix
   1057 # library API changes incompatibly from one version to the next).
   1058 #
   1059 # Unfortunately, gmake performs macro expansion on values in name=value
   1060 # command-line arguments. In the specific example above, gmake would
   1061 # eat up the "$" and "m" before it even invokes makedefs, and it
   1062 # ould replace "'${mail_version}'" and "'$(mail_version)'" with
   1063 # nothing.
   1064 #
   1065 # Requiring people to specify $$ is not a good option. Instead we
   1066 # replace the string MAIL_VERSION at the end of parameter values in
   1067 # "make makefiles name=value...". The replacement depends on usage
   1068 # context: the expanded release version in actual pathnames, or the
   1069 # unexpanded ${mail_version} in configuration parameter values (both
   1070 # main.cf and built-in defaults).
   1071 
   1072 # Helper function to determine DEF_MAIL_VERSION.
   1073 
   1074 def_mail_version()
   1075 {
   1076     trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
   1077     cat > makedefs.test.c <<'EOF'
   1078 #include <stdlib.h>
   1079 #include <stdio.h>
   1080 EOF
   1081         # Avoid "nested comment" warnings. Top-of-file comments start in
   1082         # column 1 and have no code after "*/", not even in header files.
   1083         # If this is insufficient, kill the problem with #ifndef MAKEDEFS.
   1084         sed '/^\/\*/,/\*\//d' src/global/mail_version.h >>makedefs.test.c
   1085         cat >>makedefs.test.c <<EOF
   1086 #include <stdlib.h>
   1087 #include <stdio.h>
   1088 #include <string.h>
   1089 int     main(void)
   1090 {
   1091     printf("%s\n", DEF_MAIL_VERSION);
   1092     fflush(stdout);
   1093     exit(ferror(stdout) ? 1 : 0);
   1094 }
   1095 EOF
   1096     eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
   1097     ./makedefs.test || exit 1
   1098     rm -f makedefs.test makedefs.test.[co]
   1099 }
   1100 
   1101 # Helper to expand MAIL_VERSION at the end of a command-line parameter value.
   1102 
   1103 # Note that MAIL_VERSION) does not anchor the match at the end.
   1104 
   1105 process_input_parameter()
   1106 {
   1107     echo "#" $parm_name=$parm_val
   1108     case "$parm_val" in
   1109     *MAIL_VERSION*)
   1110 	cparm_val=`echo "$parm_val" | \
   1111 	    sed 's/MAIL_VERSION$/\\\\$${mail_version}/g'`|| exit 1
   1112 	case "$mail_version" in
   1113 	"") mail_version=`def_mail_version` || exit 1
   1114 	esac
   1115 	parm_val=`echo "$parm_val" | sed 's/MAIL_VERSION$/'"$mail_version/g"` ||
   1116 	    exit 1
   1117 	case "$parm_val" in
   1118 	*MAIL_VERSION*)
   1119 	    error "MAIL_VERSION not at end of parameter value: $parm_val"
   1120 	esac
   1121 	eval ${parm_name}=\""\$parm_val"\";;
   1122      *) cparm_val="$parm_val";;
   1123     esac
   1124     CCARGS="$CCARGS -D$parm_macro=\\\"$cparm_val\\\""
   1125 }
   1126 
   1127 # Optionally override installation-parameter default settings.
   1128 
   1129 command_directory_macro=DEF_COMMAND_DIR
   1130 config_directory_macro=DEF_CONFIG_DIR
   1131 daemon_directory_macro=DEF_DAEMON_DIR
   1132 data_directory_macro=DEF_DATA_DIR
   1133 mail_spool_directory_macro=DEF_MAIL_SPOOL_DIR
   1134 mailq_path_macro=DEF_MAILQ_PATH
   1135 meta_directory_macro=DEF_META_DIR
   1136 newaliases_path_macro=DEF_NEWALIAS_PATH
   1137 queue_directory_macro=DEF_QUEUE_DIR
   1138 sendmail_path_macro=DEF_SENDMAIL_PATH
   1139 shlib_directory_macro=DEF_SHLIB_DIR
   1140 openssl_path_macro=DEF_OPENSSL_PATH
   1141 
   1142 # shlib_directory is checked here because "no" is not a good answer.
   1143 # Instead, build with "dynamicmaps=no" and "shared=no" as appropriate.
   1144 
   1145 for parm_name in command_directory config_directory daemon_directory \
   1146 	data_directory mail_spool_directory mailq_path meta_directory \
   1147 	newaliases_path queue_directory sendmail_path shlib_directory \
   1148 	openssl_path
   1149 do
   1150     eval parm_val=\"\$$parm_name\"
   1151     eval parm_macro=\"\$${parm_name}_macro\"
   1152     case "$parm_val" in
   1153     "") ;;
   1154     /*) process_input_parameter;;
   1155      *) error "$parm_name must specify an absolute path name";;
   1156     esac
   1157 done
   1158 
   1159 html_directory_macro=DEF_HTML_DIR
   1160 manpage_directory_macro=DEF_MANPAGE_DIR
   1161 readme_directory_macro=DEF_README_DIR
   1162 
   1163 for parm_name in html_directory manpage_directory readme_directory
   1164 do
   1165     eval parm_val=\"\$$parm_name\"
   1166     eval parm_macro=\"\$${parm_name}_macro\"
   1167     case "$parm_val" in
   1168     "") ;;
   1169  /*|no) process_input_parameter;;
   1170      *) error "$parm_name must specify \"no\" or an absolute path name";;
   1171     esac
   1172 done
   1173 
   1174 default_cache_db_type_macro=DEF_CACHE_DB_TYPE
   1175 default_database_type_macro=DEF_DB_TYPE
   1176 
   1177 for parm_name in default_cache_db_type default_database_type
   1178 do
   1179     eval parm_val=\"\$$parm_name\"
   1180     eval parm_macro=\"\$${parm_name}_macro\"
   1181     case "$parm_val" in
   1182     "") ;;
   1183      *) process_input_parameter;;
   1184     esac
   1185 done
   1186 
   1187 echo "# End of summary of user-configurable 'make makefiles' options."
   1188 echo "#--------------------------------------------------------------"
   1189 
   1190 # The following are for non-shared libsasl and libmilter builds.
   1191 
   1192 _AR=$AR
   1193 _RANLIB=$RANLIB
   1194 
   1195 # Choose between dynamic and static library builds.
   1196 
   1197 case "$dynamicmaps" in
   1198   yes) shared=yes;;
   1199 ""|no) ;;
   1200     *) error "Specify \"dynamicmaps=yes\" or \"dynamicmaps=no\"";;
   1201 esac
   1202 
   1203 case "$shared" in
   1204 yes)
   1205     if [ -z "$SHLIB_SUFFIX" ]
   1206     then 
   1207 	error "Shared libraries are requested, but not supported on this platform"
   1208     fi
   1209     AR=:
   1210     RANLIB=:
   1211     CCARGS="$CCARGS -DUSE_DYNAMIC_LIBS"
   1212     case "$dynamicmaps" in
   1213     yes) NON_PLUGIN_MAP_OBJ=
   1214 	 PLUGIN_MAP_OBJ='$(MAP_OBJ)'
   1215 	 PLUGIN_MAP_OBJ_UPDATE=plugin_map_obj_update
   1216 	 PLUGIN_MAP_SO_MAKE=plugin_map_so_make
   1217 	 PLUGIN_MAP_SO_UPDATE=plugin_map_so_update
   1218 	 CCARGS="$CCARGS -DUSE_DYNAMIC_MAPS"
   1219 	 ;;
   1220       *) NON_PLUGIN_MAP_OBJ='$(MAP_OBJ)'
   1221 	 PLUGIN_MAP_OBJ=
   1222 	 PLUGIN_MAP_OBJ_UPDATE=
   1223 	 PLUGIN_MAP_SO_MAKE=
   1224 	 PLUGIN_MAP_SO_UPDATE=
   1225 	 PLUGIN_LD=
   1226 	 CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS"
   1227 	 ;;
   1228     esac
   1229 
   1230     # Determine the dynamically-linked library and plugin installation
   1231     # directory.
   1232 
   1233     parm_name=shlib_directory
   1234     eval parm_val=\"\$$parm_name\"
   1235     eval parm_macro=\"\$${parm_name}_macro\"
   1236     case "$parm_val" in
   1237     /*|no) # CCARGS was already updated above.
   1238 	;;
   1239     "") trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
   1240 	sed -n '
   1241 	    /_SHLIB_DIR/,/^$/p
   1242 	' src/global/mail_params.h >makedefs.test.c
   1243 	cat >>makedefs.test.c <<EOF
   1244 #include <stdlib.h>
   1245 #include <stdio.h>
   1246 int     main(void)
   1247 {
   1248     printf("%s\n", $parm_macro);
   1249     fflush(stdout);
   1250     exit(ferror(stdout) ? 1 : 0);
   1251 }
   1252 EOF
   1253 	eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
   1254 	parm_val=`./makedefs.test` || exit 1
   1255 	rm -f makedefs.test makedefs.test.[co]
   1256 	eval ${parm_name}=\""\$parm_val"\"
   1257 	#CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\""
   1258 	;;
   1259      *) # this parameter was already checked above.
   1260 	error "Can't happen in $0 - $parm_val is not an absolute path"
   1261 	;;
   1262     esac
   1263 
   1264     LIB_PREFIX=postfix-
   1265     LIB_SUFFIX=${SHLIB_SUFFIX}
   1266     ;;
   1267 
   1268 no|"")
   1269     shlib_directory=no
   1270     CCARGS="$CCARGS -UUSE_DYNAMIC_LIBS -DDEF_SHLIB_DIR=\\\"no\\\""
   1271     CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS"
   1272     SHLIB_CFLAGS=
   1273     SHLIB_SUFFIX=
   1274     SHLIB_LD=:
   1275     SHLIB_SYSLIBS=
   1276     SHLIB_RPATH=
   1277     SHLIB_ENV=
   1278     LIB_PREFIX=
   1279     LIB_SUFFIX=.a
   1280     NON_PLUGIN_MAP_OBJ='$(MAP_OBJ)'
   1281     PLUGIN_MAP_OBJ=
   1282     PLUGIN_MAP_OBJ_UPDATE=
   1283     PLUGIN_MAP_SO_MAKE=
   1284     PLUGIN_MAP_SO_UPDATE=
   1285     PLUGIN_LD=
   1286     ;;
   1287 
   1288 *)  error "Specify \"shared=yes\" or \"shared=no\""
   1289     ;;
   1290 esac
   1291 
   1292 # "gcc -W" 3.4.2 no longer reports functions that fail to return a
   1293 # result.  Use "gcc -Wall -Wno-comment" instead. We'll figure out
   1294 # later if the other -Wmumble options are really redundant. Having
   1295 # een burned once by a compiler that lies about what warnings it
   1296 # produces, not taking that chance again.
   1297 
   1298 : ${CC=gcc} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \
   1299 ${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
   1300 	-Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
   1301 	-Wunused -Wno-missing-braces -fno-common'}
   1302 
   1303 # Extract map type names from -DHAS_XXX compiler options.  We avoid
   1304 # problems with tr(1) range syntax by using enumerations instead,
   1305 # and we don't try to figure out which awk versions have tolower().
   1306 # The following was validated in 2014 on FreeBSD/Linux and Solaris 9.
   1307 
   1308 DEFINED_MAP_TYPES=`
   1309     echo $CCARGS | sed 's/=[^ ]*//g' | 
   1310 	tr -cd '\- _ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | 
   1311 	tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | ${AWK} '
   1312 	{ for (n = 1; n <= NF; n++)
   1313 	      if ($n ~ /^-dhas_/)
   1314 		  if (seen[name = substr($n, 7)]++ == 0)
   1315 		      printf(" %s", name) }
   1316 '`
   1317 
   1318 # Propagate AUXLIBS_FOO or merge them into global AUXLIBS (i.e. SYSLIBS).
   1319 
   1320 PLUGGABLE_MAPS="CDB LDAP LMDB MONGODB MYSQL PCRE PGSQL SDBM SQLITE"
   1321 
   1322 case "$dynamicmaps" in
   1323 yes) for name in $PLUGGABLE_MAPS
   1324      do
   1325 	 eval test -n "\"\$AUXLIBS_$name\"" && 
   1326 	     eval PLUGIN_AUXLIBS="\"\$PLUGIN_AUXLIBS
   1327 AUXLIBS_$name = \$AUXLIBS_$name\""
   1328      done;;
   1329   *) for name in $PLUGGABLE_MAPS
   1330      do
   1331 	 eval AUXLIBS="\"\$AUXLIBS \$AUXLIBS_$name\""
   1332      done;;
   1333 esac
   1334 
   1335 # Remove static libraries from SYSLIBS when building shared objects,
   1336 # Can't use the shell "case" patterns to detect names ending in *.a.
   1337 
   1338 case "$shared" in
   1339 yes) SHLIB_SYSLIBS=`${AWK} '
   1340      BEGIN { wc = split("'"$AUXLIBS $SYSLIBS"'", words) 
   1341 	 for (n = 1; n <= wc; n++)
   1342 	     if (words[n] !~ /\.a$/)
   1343 		 printf(" %s", words[n])
   1344      }
   1345      '`
   1346 esac
   1347 
   1348 # Choose between PIE and non-PIE builds.
   1349 
   1350 case "$pie" in
   1351   yes) case "$shared" in
   1352         yes) CCARGS_PIE="-fPIC";;
   1353           *) CCARGS_PIE="-fPIE";;
   1354        esac
   1355        case " $CCARGS " in
   1356          *" $CCARGS_PIE "*) CCARGS_PIE=;;
   1357        esac
   1358        SYSLIBS_PIE="-pie";;
   1359 ""|no) ;;
   1360     *) error "Specify \"pie=yes\" or \"pie=no\"";;
   1361 esac
   1362 
   1363 # Don't permit random overrides.
   1364 allowed_user_install_opts="-keep-build-mtime"
   1365 for opt in $POSTFIX_INSTALL_OPTS
   1366 do
   1367     (for allowed in -keep-build-mtime
   1368     do
   1369 	test "$opt" = "$allowed" && exit 0
   1370     done; exit 1) || error "invalid option '$opt' in POSTFIX_INSTALL_OPTS"
   1371 done
   1372 
   1373 # If -DNO_DB is specified then 'hash' and 'btree' will be unavailable.
   1374 
   1375 check_no_db_overrides()
   1376 {
   1377     trap 'rm -f makedefs.test makedefs.test.[co]' 0 1 2 3 15
   1378         cat src/util/sys_defs.h >makedefs.test.c
   1379         cat >>makedefs.test.c <<'EOF'
   1380 #include <stdlib.h>
   1381 #include <stdio.h>
   1382 #include <string.h>
   1383 int     main(void)
   1384 {
   1385     struct def_info {
   1386 	const char *mac_name;
   1387 	const char *parm_name;
   1388 	const char *def_type;
   1389 	const char *problem;
   1390     };
   1391     struct def_info def_infos[] = {
   1392 	{"DEF_DB_TYPE", "default_database_type", DEF_DB_TYPE},
   1393 	{"DEF_CACHE_DB_TYPE", "default_cache_db_type", DEF_CACHE_DB_TYPE},
   1394     };
   1395     const char *bdb_types[] = {"hash", "btree"};
   1396     struct def_info *pdef_info;
   1397     const char *const * pbdb_type;
   1398     const char *three_bs = "\\\\\\";
   1399     int     status = 0;
   1400 
   1401     for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
   1402 	for (pbdb_type = bdb_types; pbdb_type < bdb_types + 2; pbdb_type++) {
   1403 	    if (strcmp(pdef_info->def_type, *pbdb_type) == 0) {
   1404 		pdef_info->problem = *pbdb_type;
   1405 		status = 1;
   1406 	    }
   1407 	}
   1408     }
   1409     if (status != 0) {
   1410 	fprintf(stderr, "\nBuilding with -DNO_DB, but at least one default "
   1411 		"setting still\nrequires 'hash' or 'btree':\n");
   1412 	for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
   1413 	    if (pdef_info->problem) {
   1414 		fprintf(stderr, "  %s=%s\n", pdef_info->parm_name,
   1415 			pdef_info->problem);
   1416 	    }
   1417 	}
   1418 	fprintf(stderr, "\nTo fix, specify types other than 'hash' or 'btree', "
   1419 			"for example:\n  make makefiles ... \\\n    ");
   1420 	for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
   1421 	    if (pdef_info->problem) {
   1422 		fprintf(stderr, " %s=lmdb", pdef_info->parm_name);
   1423 	    }
   1424 	}
   1425 	fprintf(stderr, " ...\n\nOr, using older syntax:\n");
   1426 	fprintf(stderr, "  make makefiles ... \\\n    CCARGS=\"$CCARGS -DNO_DB");
   1427 	for (pdef_info = def_infos; pdef_info < def_infos + 2; pdef_info++) {
   1428 	    if (pdef_info->problem) {
   1429 		fprintf(stderr, " -D%s=%s\"lmdb%s\"",
   1430 			pdef_info->mac_name, three_bs, three_bs);
   1431 	    }
   1432 	}
   1433 	fprintf(stderr, " ...\" ...\n\n");
   1434     }
   1435     exit(status);
   1436 }
   1437 EOF
   1438     eval ${CC-gcc} ${CCARGS} -D$SYSTYPE -o makedefs.test makedefs.test.c || exit 1
   1439     ./makedefs.test || exit 1
   1440     rm -f makedefs.test makedefs.test.[co]
   1441 }
   1442 
   1443 case "$CCARGS" in
   1444  *-DNO_DB*) check_no_db_overrides || exit 1;;
   1445 esac
   1446 
   1447 # Finally...
   1448 
   1449 sed 's/   */ /g' <<EOF
   1450 # System-dependent settings and compiler/linker overrides.
   1451 SYSTYPE	= $SYSTYPE
   1452 _AR	= $_AR
   1453 ARFL	= $ARFL
   1454 _RANLIB	= $_RANLIB
   1455 SYSLIBS	= $SYSLIBS_PIE $AUXLIBS $SYSLIBS $PLUGIN_AUXLIBS
   1456 CC	= $CC $CCARGS_PIE $CCARGS \$(WARN)
   1457 OPT	= $OPT
   1458 DEBUG	= $DEBUG
   1459 AWK	= $AWK
   1460 STRCASE = $STRCASE
   1461 EXPORT	= CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
   1462 WARN	= $WARN
   1463 DEFINED_MAP_TYPES = $DEFINED_MAP_TYPES
   1464 MAKE_FIX = $MAKE_FIX
   1465 # Switch between Postfix static and dynamically-linked libraries.
   1466 AR	= $AR
   1467 RANLIB	= $RANLIB
   1468 LIB_PREFIX = $LIB_PREFIX
   1469 LIB_SUFFIX = $LIB_SUFFIX
   1470 SHLIB_CFLAGS = $SHLIB_CFLAGS
   1471 SHLIB_DIR = $shlib_directory
   1472 SHLIB_ENV = $SHLIB_ENV
   1473 SHLIB_LD = $SHLIB_LD
   1474 SHLIB_SYSLIBS = $SHLIB_SYSLIBS
   1475 SHLIB_RPATH = $SHLIB_RPATH
   1476 # Switch between dynamicmaps.cf plugins and hard-linked databases.
   1477 NON_PLUGIN_MAP_OBJ = $NON_PLUGIN_MAP_OBJ
   1478 PLUGIN_MAP_OBJ = $PLUGIN_MAP_OBJ
   1479 PLUGIN_MAP_OBJ_UPDATE = $PLUGIN_MAP_OBJ_UPDATE
   1480 PLUGIN_MAP_SO_MAKE = $PLUGIN_MAP_SO_MAKE
   1481 PLUGIN_MAP_SO_UPDATE = $PLUGIN_MAP_SO_UPDATE
   1482 PLUGIN_LD = $PLUGIN_LD
   1483 POSTFIX_INSTALL_OPTS = $POSTFIX_INSTALL_OPTS
   1484 # Application-specific rules.
   1485 EOF
   1486