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