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