makedefs revision 1.11 1 #!/bin/sh
2
3 #++
4 # NAME
5 # makedefs 1
6 # SUMMARY
7 # makefile configuration utility
8 # SYNOPSIS
9 # \fBmake makefiles \fIname=value...\fR
10 # DESCRIPTION
11 # The \fBmakedefs\fR command identifies the compilation
12 # environment, and emits macro definitions on the standard output
13 # stream that can be prepended to template Makefiles.
14 #
15 # Default settings can be overruled by specifying them as
16 # environment variables. Use quotes if variables contain
17 # whitespace or shell meta characters.
18 # .IP \fBAUXLIBS=\fIobject_library...\fR
19 # Specifies one or more non-default object libraries.
20 # .IP \fBCC=\fIcompiler_command\fR
21 # Specifies a non-default compiler. On many systems, the default
22 # is \fBgcc\fR.
23 # .IP \fBCCARGS=\fIcompiler_arguments\fR
24 # Specifies non-default compiler arguments, for example, a non-default
25 # \fIinclude\fR directory.
26 # The following directives are special:
27 # .RS
28 # .IP \fB-DNO_DB\fR
29 # Do not build with Berkeley DB support.
30 # .IP \fB-DNO_DEVPOLL\fR
31 # Do not build with Solaris /dev/poll support.
32 # By default, /dev/poll support is compiled in on platforms that
33 # are known to support it.
34 # .IP \fB-DNO_EPOLL\fR
35 # Do not build with Linux EPOLL support.
36 # By default, EPOLL support is compiled in on platforms that
37 # are known to support it.
38 # .IP \fB-DNO_IPV6\fR
39 # Do not build with IPv6 support.
40 # By default, IPv6 support is compiled in on platforms that
41 # are known to have IPv6 support.
42 #
43 # Note: this directive is for debugging and testing only. It
44 # is not guaranteed to work on all platforms.
45 # .IP \fB-DNO_KQUEUE\fR
46 # Do not build with FreeBSD/NetBSD/OpenBSD/MacOSX KQUEUE support.
47 # By default, KQUEUE support is compiled in on platforms that
48 # are known to support it.
49 # .IP \fB-DNO_NIS\fR
50 # Do not build with NIS or NISPLUS support. Support for NIS
51 # is unavailable on some recent Linux distributions.
52 # .IP \fB-DNO_NISPLUS\fR
53 # Do not build with NISPLUS support. Support for NISPLUS
54 # is unavailable on some recent Solaris distributions.
55 # .IP \fB-DNO_PCRE\fR
56 # Do not build with PCRE support.
57 # By default, PCRE support is compiled in when the \fBpcre-config\fR
58 # utility is installed.
59 # .IP \fB-DNO_POSIX_GETPW_R\fR
60 # Disable support for POSIX getpwnam_r/getpwuid_r.
61 # .IP \fB-DNO_SIGSETJMP\fR
62 # Use setjmp()/longjmp() instead of sigsetjmp()/siglongjmp().
63 # By default, Postfix uses sigsetjmp()/siglongjmp() when they
64 # appear to work.
65 # .RE
66 # .IP \fBDEBUG=\fIdebug_level\fR
67 # Specifies a non-default debugging level. The default is \fB-g\fR.
68 # Specify \fBDEBUG=\fR to turn off debugging.
69 # .IP \fBOPT=\fIoptimization_level\fR
70 # Specifies a non-default optimization level. The default is \fB-O\fR.
71 # Specify \fBOPT=\fR to turn off optimization.
72 # .IP \fBWARN=\fIwarning_flags\fR
73 # Specifies non-default gcc compiler warning options for use when
74 # "make" is invoked in a source subdirectory only.
75 # LICENSE
76 # .ad
77 # .fi
78 # The Secure Mailer license must be distributed with this software.
79 # AUTHOR(S)
80 # Wietse Venema
81 # IBM T.J. Watson Research
82 # P.O. Box 704
83 # Yorktown Heights, NY 10598, USA
84 #--
85
86 # Emit system-dependent Makefile macro definitions to standard output.
87
88 # Defaults for most sane systems
89
90 RANLIB=ranlib
91 SYSLIBS=
92 AR=ar
93 ARFL=rv
94
95 # Ugly function to make our error message more visible among the
96 # garbage that is output by some versions of make(1).
97
98 # By now all shells must have functions.
99
100 error() {
101 # Alas, tput(1) is not portable so we can't use visual effects.
102 echo "ATTENTION:" 1>&2;
103 echo "ATTENTION:" $* 1>&2;
104 echo "ATTENTION:" 1>&2;
105 exit 1
106 }
107
108 case $# in
109 # Officially supported usage.
110 0) SYSTEM=`(uname -s) 2>/dev/null`
111 RELEASE=`(uname -r) 2>/dev/null`
112 # No ${x%%y} support in Solaris 11 /bin/sh
113 RELEASE_MAJOR=`expr "$RELEASE" : '\([0-9]*\)'` || exit 1
114 VERSION=`(uname -v) 2>/dev/null`
115 case "$VERSION" in
116 dcosx*) SYSTEM=$VERSION;;
117 esac;;
118 # Unsupported debug-only mode. Not suitable for cross-platform tests.
119 2) SYSTEM="$1"; RELEASE="$2";;
120 *) echo usage: $0 [system release] 1>&2; exit 1;;
121 esac
122
123 case "$SYSTEM.$RELEASE" in
124 SCO_SV.3.2) SYSTYPE=SCO5
125 # Use the native compiler by default
126 : ${CC="/usr/bin/cc -b elf"}
127 CCARGS="$CCARGS -DPIPES_CANT_FIONREAD $CCARGS"
128 SYSLIBS="-lsocket -ldbm"
129 RANLIB=echo
130 ;;
131 UnixWare.5*) SYSTYPE=UW7
132 # Use the native compiler by default
133 : ${CC=/usr/bin/cc}
134 RANLIB=echo
135 SYSLIBS="-lresolv -lsocket -lnsl"
136 ;;
137 UNIX_SV.4.2*) case "`uname -v`" in
138 2.1*) SYSTYPE=UW21
139 # Use the native compiler by default
140 : ${CC=/usr/bin/cc}
141 RANLIB=echo
142 SYSLIBS="-lresolv -lsocket -lnsl -lc -L/usr/ucblib -lucb"
143 ;;
144 *) error "Seems to be UnixWare`uname -v`. Untested.";;
145 esac
146 ;;
147 FreeBSD.2*) SYSTYPE=FREEBSD2
148 ;;
149 FreeBSD.3*) SYSTYPE=FREEBSD3
150 ;;
151 FreeBSD.4*) SYSTYPE=FREEBSD4
152 ;;
153 FreeBSD.5*) SYSTYPE=FREEBSD5
154 ;;
155 FreeBSD.6*) SYSTYPE=FREEBSD6
156 ;;
157 FreeBSD.7*) SYSTYPE=FREEBSD7
158 ;;
159 FreeBSD.8*) SYSTYPE=FREEBSD8
160 ;;
161 FreeBSD.9*) SYSTYPE=FREEBSD9
162 ;;
163 FreeBSD.10*) SYSTYPE=FREEBSD10
164 : ${CC=cc}
165 ;;
166 DragonFly.*) SYSTYPE=DRAGONFLY
167 ;;
168 OpenBSD.2*) SYSTYPE=OPENBSD2
169 ;;
170 OpenBSD.3*) SYSTYPE=OPENBSD3
171 ;;
172 OpenBSD.4*) SYSTYPE=OPENBSD4
173 ;;
174 OpenBSD.5*) SYSTYPE=OPENBSD5
175 ;;
176 ekkoBSD.1*) SYSTYPE=EKKOBSD1
177 ;;
178 NetBSD.1*) SYSTYPE=NETBSD1
179 ;;
180 NetBSD.2*) SYSTYPE=NETBSD2
181 ;;
182 NetBSD.3*) SYSTYPE=NETBSD3
183 ;;
184 NetBSD.4*) SYSTYPE=NETBSD4
185 ;;
186 NetBSD.5*) SYSTYPE=NETBSD5
187 ;;
188 NetBSD.6*) SYSTYPE=NETBSD6
189 ;;
190 BSD/OS.2*) SYSTYPE=BSDI2
191 ;;
192 BSD/OS.3*) SYSTYPE=BSDI3
193 ;;
194 BSD/OS.4*) SYSTYPE=BSDI4
195 ;;
196 OSF1.V[3-5].*) SYSTYPE=OSF1
197 # Use the native compiler by default
198 : ${CC=cc}
199 : ${DEBUG="-g3"}
200 case $RELEASE in
201 V[0-4].*) CCARGS="$CCARGS -DNO_IPV6";;
202 esac
203 ;;
204 SunOS.4*) SYSTYPE=SUNOS4
205 SYSLIBS=-lresolv
206 ;;
207 SunOS.5*) SYSTYPE=SUNOS5
208 RANLIB=echo
209 SYSLIBS="-lresolv -lsocket -lnsl -ldl"
210 # Stock awk breaks with >10 files.
211 test -x /usr/xpg4/bin/awk && AWK=/usr/xpg4/bin/awk
212 # Solaris 2.5 added usleep(), POSIX regexp, POSIX getpwnam/uid_r
213 case $RELEASE in
214 5.[0-4]) CCARGS="$CCARGS -DMISSING_USLEEP -DNO_POSIX_REGEXP -DNO_POSIX_GETPW_R";;
215 esac
216 # Solaris 8 added IPv6 and /dev/poll
217 case $RELEASE in
218 5.[0-7]|5.[0-7].*) CCARGS="$CCARGS -DNO_IPV6 -DNO_DEVPOLL";;
219 esac
220 # Solaris 9 added closefrom(), futimesat() and /dev/*random
221 # and appears to have solid UNIX-domain sockets.
222 case $RELEASE in
223 5.[0-8]|5.[0-8].*) CCARGS="$CCARGS -DNO_CLOSEFROM -DNO_DEV_URANDOM -DNO_FUTIMESAT -DSTREAM_CONNECTIONS";;
224 esac
225 # Somewhere NISPLUS went away.
226 case $RELEASE in
227 5.[0-9][0-9]*) CCARGS="$CCARGS -DNO_NISPLUS";;
228 esac
229 # Work around broken str*casecmp(). Do it all here instead
230 # of having half the solution in the sys_defs.h file.
231 CCARGS="$CCARGS -Dstrcasecmp=fix_strcasecmp \
232 -Dstrncasecmp=fix_strncasecmp"
233 STRCASE="strcasecmp.o"
234 # Avoid common types of braindamage
235 case "$LD_LIBRARY_PATH" in
236 ?*) error "Don't set LD_LIBRARY_PATH";;
237 esac
238 case "${CC}" in
239 *" "*) ;;
240 *ucb*) error "Don't use /usr/ucb/cc or ucblib";;
241 cc*) case `which ${CC}` in
242 *ucb*) error "Don't use /usr/ucb/cc or ucblib";;
243 esac;;
244 esac
245 ;;
246 ULTRIX.4*) SYSTYPE=ULTRIX4
247 if [ -f /usr/local/lib/libdb.a ]; then
248 SYSLIBS="$SYSLIBS -ldb"
249 CCARGS="$CCARGS -DHAS_DB"
250 if [ -d /usr/local/include/db ]; then
251 CCARGS="$CCARGS -I/usr/local/include/db"
252 fi
253 fi
254 for l in syslog resolv; do
255 if [ -f /usr/local/lib/lib$l.a ]; then
256 SYSLIBS="$SYSLIBS -l$l"
257 fi
258 done
259 ;;
260 AIX.*) case "`uname -v`" in
261 6) SYSTYPE=AIX6
262 case "$CC" in
263 cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
264 esac
265 CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
266 ;;
267 5) SYSTYPE=AIX5
268 case "$CC" in
269 cc|*/cc|xlc|*/xlc) CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
270 esac
271 CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
272 ;;
273 4) SYSTYPE=AIX4
274 # How embarrassing...
275 case "$CC" in
276 cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w -blibpath:/usr/lib:/lib:/usr/local/lib";;
277 esac
278 CCARGS="$CCARGS -D_ALL_SOURCE -DHAS_POSIX_REGEXP"
279 ;;
280 3) SYSTYPE=AIX3
281 # How embarrassing...
282 case "$CC" in
283 cc|*/cc|xlc|*/xlc) OPT=; CCARGS="$CCARGS -w";;
284 esac
285 CCARGS="$CCARGS -D_ALL_SOURCE"
286 ;;
287 *) error "Unknown AIX version: `uname -v`.";;
288 esac;;
289 # Tested with RedHat 3.03 on 20020729.
290 Linux.1*) SYSTYPE=LINUX1
291 case "$CCARGS" in
292 *-DNO_DB*) ;;
293 *-DHAS_DB*) ;;
294 *) SYSLIBS="-ldb";;
295 esac
296 ;;
297 Linux.2*) SYSTYPE=LINUX2
298 case "$CCARGS" in
299 *-DNO_DB*) ;;
300 *-DHAS_DB*) ;;
301 *) if [ -f /usr/include/db.h ]
302 then
303 : we are all set
304 elif [ -f /usr/include/db/db.h ]
305 then
306 CCARGS="$CCARGS -I/usr/include/db"
307 else
308 # No, we're not going to try db1 db2 db3 etc.
309 # On a properly installed system, Postfix builds
310 # by including <db.h> and by linking with -ldb
311 echo "No <db.h> include file found." 1>&2
312 echo "Install the appropriate db*-devel package first." 1>&2
313 exit 1
314 fi
315 SYSLIBS="-ldb"
316 ;;
317 esac
318 for name in nsl resolv $GDBM_LIBS
319 do
320 for lib in /usr/lib64 /lib64 /usr/lib /lib
321 do
322 test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
323 SYSLIBS="$SYSLIBS -l$name"
324 break
325 }
326 done
327 done
328 # Kernel 2.4 added IPv6
329 case "$RELEASE" in
330 2.[0-3].*) CCARGS="$CCARGS -DNO_IPV6";;
331 esac
332 # Kernel 2.6 added EPOLL
333 case "$RELEASE" in
334 2.[0-5].*) CCARGS="$CCARGS -DNO_EPOLL";;
335 # Workaround for retarded libc
336 2.6.*)
337 if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
338 then
339 :
340 elif [ ! -e /usr/include/sys/epoll.h ]
341 then
342 echo CCARGS="$CCARGS -DNO_EPOLL"
343 else
344 trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
345 cat >makedefs.test.c <<'EOF'
346 #include <sys/types.h>
347 #include <sys/epoll.h>
348 #include <errno.h>
349 #include <stdio.h>
350 #include <stdlib.h>
351
352 int main(int argc, char **argv)
353 {
354 int epoll_handle;
355
356 if ((epoll_handle = epoll_create(1)) < 0) {
357 perror("epoll_create");
358 exit(1);
359 }
360 exit(0);
361 }
362 EOF
363 ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
364 ./makedefs.test 2>/dev/null ||
365 CCARGS="$CCARGS -DNO_EPOLL"
366 rm -f makedefs.test makedefs.test.[co]
367 fi;;
368 esac
369 ;;
370 Linux.[34].*) SYSTYPE=LINUX$RELEASE_MAJOR
371 case "$CCARGS" in
372 *-DNO_DB*) ;;
373 *-DHAS_DB*) ;;
374 *) if [ -f /usr/include/db.h ]
375 then
376 : we are all set
377 elif [ -f /usr/include/db/db.h ]
378 then
379 CCARGS="$CCARGS -I/usr/include/db"
380 else
381 # On a properly installed system, Postfix builds
382 # by including <db.h> and by linking with -ldb
383 echo "No <db.h> include file found." 1>&2
384 echo "Install the appropriate db*-devel package first." 1>&2
385 exit 1
386 fi
387 SYSLIBS="-ldb"
388 ;;
389 esac
390 for name in nsl resolv
391 do
392 for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
393 do
394 test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
395 SYSLIBS="$SYSLIBS -l$name"
396 break
397 }
398 done
399 done
400 ;;
401 GNU.0*|GNU/kFreeBSD.[567]*)
402 SYSTYPE=GNU0
403 case "$CCARGS" in
404 *-DNO_DB*) ;;
405 *) if [ -f /usr/include/db.h ]
406 then
407 : we are all set
408 elif [ -f /usr/include/db/db.h ]
409 then
410 CCARGS="$CCARGS -I/usr/include/db"
411 else
412 # On a properly installed system, Postfix builds
413 # by including <db.h> and by linking with -ldb
414 echo "No <db.h> include file found." 1>&2
415 echo "Install the appropriate db*-devel package first." 1>&2
416 exit 1
417 fi
418 SYSLIBS="-ldb"
419 ;;
420 esac
421 for name in nsl resolv
422 do
423 for lib in /usr/lib64 /lib64 /usr/lib /lib
424 do
425 test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
426 SYSLIBS="$SYSLIBS -l$name"
427 break
428 }
429 done
430 done
431 case "`uname -s`" in
432 GNU)
433 # currently no IPv6 support on Hurd
434 CCARGS="$CCARGS -DNO_IPV6"
435 ;;
436 esac
437 ;;
438 IRIX*.5.*) SYSTYPE=IRIX5
439 # Use the native compiler by default
440 : ${CC=cc} ${DEBUG="-g3"}
441 RANLIB=echo
442 ;;
443 IRIX*.6.*) SYSTYPE=IRIX6
444 # Use the native compiler by default, and allow nested comments.
445 : ${CC="cc -woff 1009,1116,1412"}
446 RANLIB=echo
447 ;;
448 HP-UX.A.09.*) SYSTYPE=HPUX9
449 SYSLIBS=-ldbm
450 CCARGS="$CCARGS -DMISSING_USLEEP"
451 if [ -f /usr/lib/libdb.a ]; then
452 CCARGS="$CCARGS -DHAS_DB"
453 SYSLIBS="$SYSLIBS -ldb"
454 fi
455 ;;
456 HP-UX.B.10.*) SYSTYPE=HPUX10
457 CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null |
458 (grep usleep >/dev/null || echo '-DMISSING_USLEEP')`"
459 if [ -f /usr/lib/libdb.a ]; then
460 CCARGS="$CCARGS -DHAS_DB"
461 SYSLIBS=-ldb
462 fi
463 ;;
464 HP-UX.B.11.*) SYSTYPE=HPUX11
465 SYSLIBS=-lnsl
466 if [ -f /usr/lib/libdb.a ]; then
467 CCARGS="$CCARGS -DHAS_DB"
468 SYSLIBS="$SYSLIBS -ldb"
469 fi
470 ;;
471 ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
472 RANLIB=echo
473 SYSLIBS="-lresolv -lsocket -lnsl"
474 ;;
475 Darwin.*) SYSTYPE=MACOSX
476 # Use the native compiler by default
477 : ${CC=cc}
478 # Darwin > 1.3 uses awk and flat_namespace
479 case $RELEASE in
480 1.[0-3]) AWK=gawk;;
481 *) AWK=awk
482 SYSLIBS="$SYSLIBS -flat_namespace";;
483 esac
484 # Darwin 7 adds IPv6 support, BIND_8_COMPAT, NO_NETINFO
485 case $RELEASE in
486 [1-6].*) CCARGS="$CCARGS -DNO_IPV6";;
487 *) CCARGS="$CCARGS -DBIND_8_COMPAT -DNO_NETINFO";;
488 esac
489 # Darwin 9.0 (MacOS X 10.5) adds POSIX getpwnam_r/getpwuid_r
490 case $RELEASE in
491 [1-8].*) CCARGS="$CCARGS -DNO_POSIX_GETPW_R";;
492 esac
493 # Darwin 10.3.0 no longer has <nameser8_compat.h>.
494 case $RELEASE in
495 ?.*) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_NAMESER8_COMPAT_H";;
496 *) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_ARPA_NAMESER_COMPAT_H";;
497 esac
498 # Darwin 11.x (MacOS X 10.7.x), maybe earlier, needs libresolv.
499 case $RELEASE in
500 ?.*|10.*) ;;
501 *) SYSLIBS="$SYSLIBS -lresolv";;
502 esac
503 # kqueue and/or poll are broken in MacOS X 10.5 (Darwin 9).
504 # kqueue works in Mac OS X 10.8 (Darwin 12).
505 case $RELEASE in
506 ?.*|1[0-1].*) CCARGS="$CCARGS -DNO_KQUEUE";;
507 esac
508 ;;
509 dcosx.1*) SYSTYPE=DCOSX1
510 RANLIB=echo
511 SYSLIBS="-lresolv -lsocket -lnsl -lc -lrpcsvc -L/usr/ucblib -lucb"
512 ;;
513
514 ".") if [ -d /NextApps ]; then
515 SYSTYPE=`hostinfo | sed -n \
516 's/^.*NeXT Mach 3.*$/NEXTSTEP3/;/NEXTSTEP3/{p;q;}'`
517 if [ "$SYSTYPE" = "" ]; then
518 SYSTYPE=`hostinfo | sed -n \
519 's/^.*NeXT Mach 4.*$/OPENSTEP4/;/OPENSTEP4/{p;q;}'`
520 fi
521 : ${CC=cc}
522 RANLIB="sleep 5; ranlib"
523 else
524 error "Unable to determine your system type."
525 fi
526 ;;
527 *) error "Unknown system type: $SYSTEM $RELEASE";;
528 esac
529
530 #
531 # sigsetjmp()/siglongjmp() can be "better" than setjmp()/longjmp()
532 # if used wisely (that is: almost never, just like signals).
533 # Unfortunately some implementations have been buggy in the past.
534 #
535 case "$CCARGS" in
536 *-DNO_SIGSETJMP*) ;;
537 *) trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
538 cat >makedefs.test.c <<'EOF'
539 #include <setjmp.h>
540 #include <stdlib.h>
541 #include <stdio.h>
542
543 static int count = 0;
544
545 int main(int argc, char **argv)
546 {
547 sigjmp_buf env;
548 int retval;
549
550 switch (retval = sigsetjmp(env, 1)) {
551 case 0:
552 siglongjmp(env, 12345);
553 case 12345:
554 break;
555 default:
556 fprintf(stderr, "Error: siglongjmp ignores second argument\n");
557 exit(1);
558 }
559
560 switch (retval = sigsetjmp(env, 1)) {
561 case 0:
562 if (count++ > 0) {
563 fprintf(stderr, "Error: not overriding siglongjmp(env, 0)\n");
564 exit(1);
565 }
566 siglongjmp(env, 0);
567 case 1:
568 break;
569 default:
570 fprintf(stderr, "Error: overriding siglongjmp(env, 0) with %d\n",
571 retval);
572 exit(1);
573 }
574 exit(0);
575 }
576 EOF
577 ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
578 ./makedefs.test 2>/dev/null ||
579 CCARGS="$CCARGS -DNO_SIGSETJMP"
580 rm -f makedefs.test makedefs.test.[co]
581 esac
582
583 #
584 # OpenSSL has no configuration query utility, but we don't try to
585 # guess. We assume includes in /usr/include/openssl and libraries in
586 # /usr/lib, or in their /usr/local equivalents. If the OpenSSL files
587 # are in a non-standard place, their locations need to be specified.
588 #
589 #case "$CCARGS" in
590 # *-DUSE_TLS*) ;;
591 # *-DNO_TLS*) ;;
592 # *) CCARGS="$CCARGS -DUSE_TLS"
593 # AUXLIBS="$AUXLIBS -lssl -lcrypto"
594 # ;;
595 #esac
596
597 #
598 # PCRE 3.x has a pcre-config utility so we don't have to guess.
599 #
600 case "$CCARGS" in
601 *-DHAS_PCRE*) ;;
602 *-DNO_PCRE*) ;;
603 *) pcre_cflags=`(pcre-config --cflags) 2>/dev/null` &&
604 pcre_libs=`(pcre-config --libs) 2>/dev/null` && {
605 CCARGS="$CCARGS -DHAS_PCRE $pcre_cflags"
606 AUXLIBS="$AUXLIBS $pcre_libs"
607 }
608 ;;
609 esac
610
611 # Defaults that can be overruled (make makefiles CC=cc OPT=-O6 DEBUG=)
612 # Disable optimizations by default when compiling for Purify. Disable
613 # optimizations by default with gcc 2.8, until the compiler is known to
614 # be OK. Those who dare can still overrule this (make makefiles OPT=-O).
615
616 case "$CC" in
617 *purify*) : ${OPT=};;
618 */gcc|gcc) case `$CC -v` in
619 "gcc version 2.8"*) : ${OPT=};;
620 esac;;
621 *CC) error "Don't use CC. That's the C++ compiler";;
622 *) : ${OPT='-O'};;
623 esac
624 #
625 # "gcc -W" 3.4.2 no longer reports functions that fail to return a
626 # result. Use "gcc -Wall -Wno-comment" instead. We'll figure out
627 # later if the other -Wmumble options are really redundant. Having
628 # een burned once by a compiler that lies about what warnings it
629 # produces, not taking that chance again.
630
631 : ${CC=gcc} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \
632 ${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
633 -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
634 -Wunused -Wno-missing-braces'}
635
636 export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS
637
638 # Snapshot only.
639 #CCARGS="$CCARGS -DSNAPSHOT"
640
641 # Non-production: needs thorough testing, or major changes are still
642 # needed before the code stabilizes.
643 #CCARGS="$CCARGS -DNONPROD"
644
645 # Workaround: prepend Postfix include files before other include files.
646 CCARGS="-I. -I../../include $CCARGS"
647
648 sed 's/ / /g' <<EOF
649 SYSTYPE = $SYSTYPE
650 AR = $AR
651 ARFL = $ARFL
652 RANLIB = $RANLIB
653 SYSLIBS = $AUXLIBS $SYSLIBS
654 CC = $CC $CCARGS \$(WARN)
655 OPT = $OPT
656 DEBUG = $DEBUG
657 AWK = $AWK
658 STRCASE = $STRCASE
659 EXPORT = AUXLIBS='$AUXLIBS' CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
660 WARN = $WARN
661 EOF
662