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