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