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